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')
INVALID_INPUT
Error: Invalid input for tool 'searchArticles'
Code: INVALID_INPUTCause: Input doesn’t match the tool’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.executeExposedTool(
'demo/article-search',
'searchArticles',
{ topic: 'AI' } // Correct
// { topic: 123 } // Wrong: number instead of string
);INVALID_OUTPUT
Error: Tool "searchArticles" returned invalid output
Code: INVALID_OUTPUTCause: Trik returned data that doesn’t match declared schema.
Solution:
- Check your tool handler returns correct structure
- Verify output matches outputSchema (tool mode) or logSchema (conversational mode)
- Ensure all declared properties are present with correct types
EXECUTION_TIMEOUT
Error: Trik execution timed out
Code: EXECUTION_TIMEOUTCause: Trik exceeded maxTurnTimeMs.
Solution:
- Increase
limits.maxTurnTimeMsin manifest - Optimize trik code
- Check for infinite loops or blocking operations
HANDOFF_IN_PROGRESS
Error: A handoff is already active
Code: HANDOFF_IN_PROGRESSCause: Attempted to start a new handoff while one is already active.
Solution:
- Complete the current handoff first (trik calls
transfer_back) - Force transfer-back with
/backcommand - Use
gateway.getActiveHandoff()to check the current state before starting a new handoff
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: schemaVersion, id, name, version, agent, entry
- Check JSON syntax
- Run
trik lint .
ENTRY_NOT_FOUND
Error: Entry module not found: ./dist/index.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
Linter Errors
tdps-agent-safe-output
⚠ [tdps-agent-safe-output] outputSchema property "summary" uses an unconstrained stringCause: A string property in outputSchema has no constraint (enum, format, or pattern). maxLength alone is not agent-safe.
Solution: Add enum, format, or pattern to the property, or use conversational mode with logSchema for free-text content.
tdps-constrained-log
⚠ [tdps-constrained-log] logSchema property "query" is an unconstrained stringCause: A string property in logSchema has no constraint (enum, format, pattern, or maxLength).
Solution: Add at least one constraint. For logSchema, maxLength is acceptable.
tdps-log-template
⚠ [tdps-log-template] logTemplate placeholder "{{xyz}}" not found in logSchemaCause: A {{placeholder}} in logTemplate doesn’t match any property in logSchema.
Solution: Add the missing property to logSchema or fix the placeholder name.
tdps-output-template
⚠ [tdps-output-template] outputTemplate placeholder "{{xyz}}" not found in outputSchemaCause: A {{placeholder}} in outputTemplate doesn’t match any property in outputSchema.
Solution: Add the missing property to outputSchema or fix the placeholder name.
LangChain Errors
TOOL_EXECUTION_FAILED
Error: Tool execution failedCause: Gateway returned an error during tool execution.
Solution:
- Enable debug mode when loading triks
- Check gateway result for error details
- Verify input matches expected schema
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
import { loadLangChainTriks } from '@trikhub/langchain';
const { tools } = await loadLangChainTriks({
debug: true
});Check Full Error
try {
const result = await gateway.routeMessage(message, sessionId);
} catch (error) {
console.error('Full error:', error);
console.error('Error code:', error.code);
console.error('Error message:', error.message);
}Validate Manifest
trik lint .Check Handoff State
const activeHandoff = gateway.getActiveHandoff();
console.log('Active handoff:', activeHandoff);
// { trikId: "article-search", sessionId: "...", turnCount: 3 } or nullTest Tool Execution Directly
// For tool-mode triks
const output = await gateway.executeExposedTool(
'my-trik',
'searchArticles',
{ topic: 'AI' }
);
console.log('Output:', output);