Troubleshooting
Common issues and their solutions when using Khaos.
Local Issues
Agent not found in registry
If you see "Agent 'name' not found in registry", you need to discover your agents first:
# Run discover from your repo root
khaos discover
# Then run by agent name
khaos run <agent-name>
# List discovered agents
khaos agents listMake sure your handler is decorated with @khaosagent(name=..., version=...). Discovery scans for these decorators to register agents.
Agent script not found
Ensure the path to your agent is correct and the file exists:
# Discover from your project directory
cd /path/to/your/project
khaos discover
# Run by agent name
khaos run <agent-name>Missing API keys
Khaos passes through environment variables to your agent. Make sure your API keys are set:
# Option 1: Export in shell
export OPENAI_API_KEY=sk-...
khaos run <agent-name>
# Option 2: Pass via --env flag
khaos run <agent-name> --env OPENAI_API_KEY=sk-...Framework not detected
If Khaos isn't capturing LLM calls, ensure your framework is imported at module level:
# Good - imports at top level
from openai import OpenAI
client = OpenAI()
# Problematic - dynamic imports may not be detected
def get_client():
from openai import OpenAI # May not be detected
return OpenAI()Timeout errors
Increase the timeout for long-running agents:
# Default is 120 seconds
khaos run <agent-name> --timeout 300Cloud Sync Issues
No pending runs
If khaos sync reports "No pending runs", you probably ran without the --sync flag:
# Run with sync enabled
khaos run <agent-name> --sync
# Or sync a specific run by ID
khaos sync --run run-abc123401 Unauthenticated
Your session has expired. Re-authenticate by running sync (it will auto-login):
# Auto-login when syncing
khaos sync
# Or force re-login to reset credentials
khaos sync --login403 runs_cap / storage_cap / plan_limit
You've hit your plan limits. Options:
- Wait until your monthly limit resets
- Upgrade your plan in the dashboard
- Delete old runs to free up storage
CI/CD Issues
Exit code meanings
| Code | Meaning | Solution |
|---|---|---|
1 | Security threshold failed | Improve agent security or lower threshold |
2 | Resilience threshold failed | Improve error handling or lower threshold |
3 | Both thresholds failed | Review agent thoroughly |
4 | Baseline tests failed | Check agent basic functionality |
5 | Regression detected | Review changes vs baseline |
JUnit XML not generated
Ensure you specify the output file:
khaos ci <agent-name> --format junit --output-file results.xmlDashboard Issues
Links return 404
Use owner-scoped URLs in the format /owner/project:
# Correct format
https://app.khaos.dev/myteam/myproject
# Incorrect (legacy)
https://app.khaos.dev/myprojectRun not appearing
Check sync status to see if the upload is pending or failed:
khaos sync --statusGetting Help
If you're still stuck:
- Check the CLI Reference for command details
- Use
--verboseflag for detailed debug output - Contact support through the dashboard