Troubleshooting & FAQ
Diagnostics
Section titled “Diagnostics”Running kj doctor
Section titled “Running kj doctor”The built-in diagnostic command checks your entire setup:
kj doctorIt runs checks grouped by area (system, config, agent CLIs, Sonar, RAG embedder, CI, tokens, MCP servers, ports, Node and more); kj doctor --verbose shows each one with its fix.
Each check ends as OK, FIXED, WARN, FAIL, SKIPPED or TIMEOUT, with a suggested fix when it fails.
Installation & Setup
Section titled “Installation & Setup”Agent binary not found
Section titled “Agent binary not found”Symptom: kj doctor reports an agent CLI as missing, or kj code / kj review --staged fail naming the agent.
Cause: The agent CLI isn’t installed or isn’t in your PATH.
Fix:
# Verify the binary is accessiblewhich claude # or codex, gemini, aider
# If not found, install globallynpm install -g @anthropic-ai/claude-code # Claudenpm install -g @openai/codex # Codexkj install-tools # installs the agent CLIs kj needsKarajan searches these directories for binaries:
- System PATH (
which) /opt/node/bin,~/.npm-global/bin,/usr/local/bin,~/.local/bin- NVM directories:
~/.nvm/versions/node/*/bin
Config file not found
Section titled “Config file not found”Symptom: kj doctor reports missing config.
Fix:
kj initThis creates ~/.karajan/kj.config.yml with sensible defaults. For project-specific config, create .karajan/kj.config.yml in your project root.
SonarQube Issues
Section titled “SonarQube Issues”Container won’t start
Section titled “Container won’t start”Symptom: SonarQube not reachable at http://localhost:9000.
Fix:
# Check if Docker is runningdocker ps
# Start the SonarQube container kj manages (karajan-sonarqube)kj sonar startkj sonar status
# Wait ~30 seconds for SonarQube to initializeLinux-specific: If SonarQube crashes immediately, increase the virtual memory limit:
sudo sysctl -w vm.max_map_count=262144# Make permanent:echo "vm.max_map_count=262144" | sudo tee -a /etc/sysctl.confAuthentication failed (401)
Section titled “Authentication failed (401)”Symptom: SonarQube authentication failed during scan.
Fix:
- Open
http://localhost:9000→ My Account → Security - Generate a new token (type: Global Analysis Token)
- Update your config:
sonarqube: token: "squ_your_new_token_here"Or set via environment variable: export KJ_SONAR_TOKEN=squ_...
Quality gate fails repeatedly
Section titled “Quality gate fails repeatedly”Symptom: kj review --staged keeps stopping at the Sonar pre-gate.
Fix options:
# Skip the Sonar pre-gate for this reviewkj review --staged --no-sonarWhat blocks is sonarqube.gate_block_on (by default: new reliability, security or maintainability rating E, new coverage below 80%, new duplicated lines above 5%).
Scan timeout
Section titled “Scan timeout”Symptom: SonarQube scan exceeds time limit.
Fix: Increase the scanner timeout (default: 15 minutes):
sonarqube: timeouts: scanner_ms: 1800000 # 30 minutesAgent Issues
Section titled “Agent Issues”Reviewer rejects code repeatedly
Section titled “Reviewer rejects code repeatedly”Symptom: kj review --staged rejects the same change more than once.
Fix: have the coder apply the findings (kj code --card <id> --retry --brief), or, if your agent disagrees with them, ask a third AI to arbitrate: kj solomon --position "<why>" (security findings are never overridable).
Picking another reviewer
Section titled “Picking another reviewer”Pick another reviewer for one review with kj review --staged --reviewer <agent>, or set reviewer_options.fallback_reviewer; a reviewer out of quota is replaced for that review only, never by the host.
MCP Server Issues
Section titled “MCP Server Issues”Transport closed after updating Karajan Code
Section titled “Transport closed after updating Karajan Code”Symptom: MCP calls fail immediately (even kj_config / kj_doctor) and your host reports Transport closed.
Cause: The MCP host is still connected to an older karajan-mcp process. After a version change, Karajan exits stale MCP processes so the host can restart with the updated code.
Fix:
# 1) restart your MCP host session (Claude/Codex)
# 2) verify server registration/listcodex mcp list
# 3) smoke check before long runs# call kj_config, then kj_doctorMCP server not responding
Section titled “MCP server not responding”Symptom: Claude Code or Codex can’t connect to karajan-mcp.
Fix:
# Check if the process is runningps aux | grep karajan-mcp
# Restart your AI agent (it spawns a new MCP session)# Or verify installationkarajan-mcp --helpOrphaned Node processes
Section titled “Orphaned Node processes”Symptom: Multiple karajan-mcp processes accumulate.
Fix: Since v1.2.3, Karajan includes an orphan guard that automatically exits when the parent process dies. For older versions:
# Find and kill orphaned processesps aux | grep "karajan-code/src/mcp/server.js"kill <pid>MCP error codes
Section titled “MCP error codes”When an MCP tool fails, the category field of its answer tells you what happened, and suggestion how to fix it:
| Error Type | Meaning | Fix |
|---|---|---|
sonar_unavailable |
SonarQube not reachable | Start Docker, run kj_init |
auth_error |
401 Unauthorized | Regenerate SonarQube token |
config_error |
Invalid configuration | Run kj_doctor or kj_init |
agent_missing |
CLI not found | Install the agent, run kj_doctor |
timeout |
Time limit exceeded | Increase timeoutMs or maxIterationMinutes |
branch_error |
You are on the base branch | Create a feature branch, then retry |
agent_stall |
The agent stopped producing output | Retry with a smaller task |
bootstrap_error |
Environment prerequisites not met | Run kj_doctor and fix what it lists |
git_error |
Not in a git repo | Run git init or navigate to project root |
Git Issues
Section titled “Git Issues”“Not a git repository”
Section titled ““Not a git repository””Symptom: Karajan refuses to run.
Fix: Karajan requires a git repo. Initialize one or navigate to your project root:
git init# orcd /path/to/your/projectPR creation fails
Section titled “PR creation fails”Symptom: kj review --publish-pr or --verify-pr fails with a gh error.
Fix: Ensure the GitHub CLI is installed and authenticated:
# Installbrew install gh # macOSsudo apt install gh # Debian/Ubuntu
# Authenticategh auth login
# Verifygh repo viewTDD Policy Violations
Section titled “TDD Policy Violations”Source changes without tests
Section titled “Source changes without tests”Symptom: kj review --staged warns (or, with kj gates set tests-with-code block, refuses) that the staged diff touches source files without touching a test.
Fix options:
- Write tests first (recommended): modify test files before implementation
- Deletions and comment-only cleanups pass without a test; anything else needs one.
Test file patterns recognized: /tests/, /__tests__/, .test., .spec.
Karajan runs on your agents’ own CLI subscriptions; the HU Board’s Usage page (/usage.html) sums every agent call kj launched, per project and account, with a CSV per project and month. See Observability.
Plugin Issues
Section titled “Plugin Issues”Plugin not loading
Section titled “Plugin not loading”Symptom: Custom plugin agent not available.
Fix: Check these requirements:
-
File is in the correct directory:
- Project:
<project>/.karajan/plugins/*.js - Global:
~/.karajan/plugins/*.js
- Project:
-
File exports a
registerfunction:export function register(api) {api.registerAgent("my-agent", MyAgentClass, { bin: "my-cli" });return { name: "my-plugin" };} -
File is a valid ES module (uses
import/export, notrequire/module.exports)
Debug: kj does not print plugin load errors today; load the file yourself with node -e 'import("./.karajan/plugins/my-plugin.js").then((m) => console.log(Object.keys(m)))' to see its exports.
“No register() export found”
Section titled ““No register() export found””Symptom: Warning in logs about missing register().
Fix: Your plugin must export a named register function:
// Correctexport function register(api) { ... }
// Also accepted: a default export with registerexport default { register(api) { ... } }
// Wrong — CommonJSmodule.exports = { register(api) { ... } }What AI agents does Karajan Code support?
Section titled “What AI agents does Karajan Code support?”Claude, Codex, Gemini, Aider, OpenCode, Qwen, Copilot, Kimi and agy out of the box (kj agents lists them, kj doctor shows which are installed). You can mix and match: use one as coder and another as reviewer. You can also create custom agents via plugins.
Can I choose which model each role uses?
Section titled “Can I choose which model each role uses?”Yes. The coder’s model follows the card’s tier (kj hu add --tier trivial|standard|deep) unless you fix one (roles.coder.model in the config); the reviewer’s comes from roles.reviewer.model or kj review --staged --reviewer-model <model>. kj agents shows which provider holds each role.
Does it cost money?
Section titled “Does it cost money?”Karajan Code itself is free and open source (AGPL-3.0). It runs on your existing AI agent CLI subscriptions (Claude Pro, Codex, etc.), with no additional API keys. You pay only your existing plan, regardless of how many tasks you run. The HU Board’s Usage page shows every agent call kj launched, with its tokens and the cost its agent reported.
Do I need Docker?
Section titled “Do I need Docker?”Only for SonarQube static analysis. Skip it with --no-sonar or sonarqube.enabled: false.
Can I use it without SonarQube?
Section titled “Can I use it without SonarQube?”Yes. SonarQube is optional. Disable it globally:
sonarqube: enabled: falseOr for one review: kj review --staged --no-sonar
What happens when the coder and reviewer disagree?
Section titled “What happens when the coder and reviewer disagree?”When your agent disagrees with a rejected review, kj solomon --position "<why>" asks a third AI to arbitrate; security findings are never overridable.
Where do I see what kj measured?
Section titled “Where do I see what kj measured?”kj report # the project blocks: review truth, panel, coder models (and the latest session, if any)kj report --session-id <id> # a specific sessionKarajan Code™ · AGPL-3.0