Error Codes
Common errors and how to resolve them.
Gateway Errors
TRIK_NOT_FOUND
Error: Trik 'xyz' not found
Code: TRIK_NOT_FOUNDCause: The specified trik is not loaded in the gateway.
Solution:
- Check the trik ID spelling
- Ensure the trik is in
.trikhub/config.json - Run
trik listto see installed triks - Load the trik:
await gateway.loadTrik('./path/to/trik')
ACTION_NOT_FOUND
Error: Action 'xyz' not found in trik 'abc'
Code: ACTION_NOT_FOUNDCause: The action doesn’t exist in the trik’s manifest.
Solution:
- Run
trik info <trik>to see available actions - Check spelling of action name
- Verify manifest.json has the action defined
INVALID_INPUT
Error: Invalid input for action 'search'
Code: INVALID_INPUTCause: Input doesn’t match the action’s inputSchema.
Solution:
- Check the inputSchema in manifest.json
- Ensure required fields are present
- Verify types match (string, integer, etc.)
Example:
// Schema requires 'topic' as string
const result = await gateway.execute('demo/article-search', 'search', {
topic: 'AI' // Correct
// topic: 123 // Wrong: number instead of string
});INVALID_OUTPUT
Error: Invalid output from trik
Code: INVALID_OUTPUTCause: Trik returned data that doesn’t match declared schema.
Solution:
- Check your graph.ts returns correct structure
- Verify agentData matches agentDataSchema
- Verify userContent matches userContentSchema
EXECUTION_TIMEOUT
Error: Trik execution timed out
Code: EXECUTION_TIMEOUTCause: Trik exceeded maxExecutionTimeMs.
Solution:
- Increase
limits.maxExecutionTimeMsin manifest - Optimize trik code
- Check for infinite loops or blocking operations
SESSION_EXPIRED
Error: Session expired
Code: SESSION_EXPIREDCause: Session exceeded maxDurationMs.
Solution:
- Start a new session (don’t pass sessionId)
- Increase
capabilities.session.maxDurationMs
SESSION_NOT_FOUND
Error: Session not found
Code: SESSION_NOT_FOUNDCause: Session ID doesn’t exist or was deleted.
Solution:
- Don’t pass sessionId for first request
- Store and reuse sessionId from responses
- Handle session errors by starting fresh
CLI Errors
NOT_AUTHENTICATED
Error: Not authenticated. Run 'trik login' first.
Code: NOT_AUTHENTICATEDCause: Trying to publish without authentication.
Solution:
trik loginTRIK_NOT_INSTALLED
Error: Trik '@xyz/abc' is not installed
Code: TRIK_NOT_INSTALLEDCause: Trying to uninstall or upgrade a trik that isn’t installed.
Solution:
trik list # Check installed triks
trik install @xyz/abc # Install firstVERSION_EXISTS
Error: Version 1.0.0 already exists
Code: VERSION_EXISTSCause: Trying to publish a version that’s already published.
Solution:
- Increment version in manifest.json
- Use
trik publish -t <new-version>
INVALID_MANIFEST
Error: Invalid manifest.json
Code: INVALID_MANIFESTCause: Manifest doesn’t meet requirements.
Solution:
- Validate required fields: id, name, version, actions, entry
- Check JSON syntax
- Run
trik validate ./manifest.json
ENTRY_NOT_FOUND
Error: Entry module not found: ./dist/graph.js
Code: ENTRY_NOT_FOUNDCause: The file specified in entry.module doesn’t exist.
Solution:
- Run
npm run buildto compile TypeScript - Check entry.module path in manifest.json
- Verify file exists at the specified path
LangChain Errors
TOOL_EXECUTION_FAILED
Error: Tool execution failedCause: Gateway returned an error during tool execution.
Solution:
- Enable debug mode:
loadLangChainTriks({ debug: true }) - Check gateway result for error details
- Verify input matches expected schema
PASSTHROUGH_CONTENT_NOT_FOUND
Error: Content not found or expiredCause: Passthrough content reference is invalid or expired.
Solution:
- Deliver content immediately after receiving ref
- Don’t store refs for later use
- Re-execute the action to get fresh content
Registry Errors
RATE_LIMITED
Error: Rate limit exceeded
Code: RATE_LIMITEDCause: Too many API requests.
Solution:
- Wait for rate limit reset (check X-RateLimit-Reset header)
- Reduce request frequency
- Cache responses locally
FORBIDDEN
Error: You don't have permission to publish this trik
Code: FORBIDDENCause: Trying to publish to a scope you don’t own.
Solution:
- Use your GitHub username as scope:
@yourusername/trik-name - Ensure you’re logged in as the correct user
Debugging Tips
Enable Debug Logging
const { tools } = await loadLangChainTriks({
debug: true
});Check Full Error
try {
const result = await gateway.execute(...);
} catch (error) {
console.error('Full error:', error);
console.error('Error code:', error.code);
console.error('Error message:', error.message);
}Validate Manifest
trik validate ./manifest.jsonTest Action Directly
import graph from './graph';
const result = await graph.invoke({
action: 'search',
input: { topic: 'AI' }
});
console.log('Result:', JSON.stringify(result, null, 2));