Automergent Troubleshooting & FAQ

Diagnose common issues, understand error codes, check terminal compatibility, and find answers to frequently asked questions.

Quick Diagnosis: Run automergent doctor or /doctor inside the TUI to automatically test your environment, API keys, provider latency, LSP diagnostics, and disk permissions.

Provider & Connection Issues

⚠️

Provider Connection Failed

connection

Automergent cannot reach the AI provider API endpoint.

Symptom Error: Provider connection failed — could not reach api.example.com
Solutions
  • Verify your API key is configured: run amt /env or check GOOGLE_API_KEY / GEMINI_API_KEY.
  • Check network connectivity: curl -s -o /dev/null -w "%{http_code}" https://generativelanguage.googleapis.com
  • If using a custom base URL, confirm it includes the full path (e.g., https://api.openai.com/v1).
  • For corporate proxies, set HTTP_PROXY / HTTPS_PROXY environment variables.
  • Check provider status pages for outages (Google AI Studio, Vertex AI, OpenAI).
📅

Context Window Too Long

context

The conversation context has exceeded the model's context window limit.

Symptom Error: CONTEXT_TOO_LONG — context window exceeded (198,000 / 128,000 tokens)
Solutions
  • Run /compact to summarize and compress the conversation history.
  • Monitor usage in real-time with /context — compact when approaching 80%.
  • Start a fresh session: /new — carry over key context manually.
  • Automergent supports up to 1M+ tokens on Gemini 3.6 / Vertex AI models natively.
Tip: Automergent automatically triggers compaction when reaching autoCompressAt: 0.55 (55% budget).
🔒

Tool Confirmation Keeps Appearing

permissions

The approval prompt appears repeatedly for safe, routine operations.

Solutions
  • Switch approval mode: /mode accept-edits or /mode auto (caution).
  • Configure permissions in ~/.automergent/config.yaml or .automergent/config.yaml.
  • Cycle approval modes anytime with Shift+Tab in the terminal.
📱

TUI Looks Broken

display

Characters are garbled, colors missing, or layout is misaligned.

Solutions
  • Ensure your terminal supports truecolor (24-bit color). Run /env to check.
  • Try a modern terminal: iTerm2, WezTerm, Alacritty, kitty, Ghostty, Windows Terminal.
  • Set TERM=xterm-256color as a fallback.
  • Increase terminal window to at least 80×24 characters (recommended 120×40).
🔧

Build Fails

build

The Go build fails with compilation or linking errors.

Symptom go build ./cmd/automergent: build constraints exclude all Go files or CGO-related errors.
Solutions
  • Ensure Go 1.25+ is installed: go version
  • CGO is required for tree-sitter AST parsing: CGO_ENABLED=1 go build ./cmd/automergent
  • On Linux, install gcc or musl-gcc for CGO compilation.
  • On macOS, install Xcode Command Line Tools: xcode-select --install
💾

Session Not Saving

storage

Session data is lost between runs or history is not persisted.

Solutions
  • Check session directory exists and is writable: ls -la ~/.automergent/sessions/
  • Ensure disk space is available: df -h ~/.automergent/
  • Run automergent doctor to validate storage permissions.
🤖

Sub-Agent Not Responding

agent

A spawned sub-agent appears stuck or never completes.

Solutions
  • Check agent status: /agents — review active and completed agents in the fleet.
  • Cancel a stuck agent: /cancel agent <id>
  • Use /agents kill-all to terminate all stuck background subagents.
🎨

Theme Colors Look Wrong

theme

Colors are washed out, incorrect, or appear as solid blocks.

Solutions
  • Verify truecolor support: /env — check Truecolor field.
  • Switch themes: /theme modern, /theme catppuccin, /theme tokyonight, /theme dracula, etc.
  • For tmux/screen, use set -ga terminal-overrides ",*256col*:Tc" in .tmux.conf.
🔌

MCP Server Not Connecting

mcp

Custom MCP servers fail to start or tools are not available.

Solutions
  • Check MCP config in ~/.automergent/config.yaml under mcp.servers for syntax errors.
  • Verify transport type matches: "stdio" (default) or "sse".
  • For stdio servers, ensure the binary is in PATH or uses an absolute path.
  • Run /mcp in the TUI to check server connectivity and registered dynamic tools.
🛡️

Sandbox Blocking Legitimate Operations

sandbox

File writes or commands are blocked by the security sandbox.

Solutions
  • Check sandbox config in .automergent/config.yaml.
  • Add allowed paths: allowedWritePaths: [".", "/tmp/build"]
  • Run with --no-sandbox or configure sandbox: auto in config.
  • Use /doctor to see sandbox status and recent violations.
  • For debugging, run with --no-sandbox flag (not recommended in production).

Diagnostics Commands

Built-in commands for runtime inspection and debugging.

CommandDescriptionUse Case
/doctor Full health check — provider connectivity, storage, LSP, permissions, paths First step when anything seems wrong
/env Runtime environment report — OS, Go version, terminal capabilities, TERM value Debug TUI display or compatibility issues
/error API error log with retry counts, failure details, and request IDs Investigate provider errors or failures
/error clear Clear the error log Reset after fixing issues
/stats Session stats dashboard — files changed, tools used, duration, agent count Understand session activity
/cost Session cost and token totals — input, output, cached, estimated USD Monitor API spend
/context Context window usage breakdown — messages, files, tools, system prompt Know when to compact or start fresh
Recommended workflow: Run /doctor first, then /env and /error to narrow down the root cause. Include output when filing bug reports.

Error Code Reference

Structured error codes returned by Automergent and provider APIs.

Automergent Error Codes

CodeDescriptionAction
CONTEXT_TOO_LONG Context window exceeded model limit Run /compact or start a new session
PROVIDER_ERROR Unrecoverable API error after retries Check /error for details, verify API key
TOOL_FAILED Tool execution returned an error Check tool output, verify file permissions
SANDBOX_VIOLATION Operation blocked by sandbox Adjust .opencode/sandbox.json
SESSION_FULL Session storage quota exceeded Clear old sessions or expand storage
AGENT_TIMEOUT Sub-agent exceeded execution timeout Increase timeout or simplify the task

Provider API Errors

HTTP StatusErrorTypical Cause
400 Bad Request Invalid model name, malformed request body
401 Unauthorized Invalid or expired API key
403 Forbidden API key lacks permission for this model/endpoint
429 Rate Limited Too many requests — back off and retry
500 Internal Server Error Provider-side issue — retry or check status page
503 Service Unavailable Provider is down or overloaded

Performance Tips

⚡ Model Selection

  • Use a fast model (GPT-4o-mini, Haiku) for read-only sub-agents like /explore.
  • Reserve heavyweight models (Opus, GPT-4o) for complex reasoning and code generation.
  • Use /model to switch mid-session based on task complexity.

📊 Context Management

  • Run /context periodically to monitor window usage.
  • Compact at 80% capacity — don't wait for errors.
  • Start new sessions for unrelated tasks rather than carrying stale context.

🤖 Sub-Agents

  • Use sub-agents for parallel work — research + implement simultaneously.
  • Keep sub-agent tasks focused and well-scoped for faster completion.
  • Set appropriate thinking budget — lower for simple tasks, higher for complex refactors.

🚀 Session Optimization

  • Compact regularly during long sessions (every 20–30 min).
  • Use /summary to generate session summaries before starting new work.
  • Close idle sub-agents to free up context and API budget.

Security FAQ

🛡️ How Sandboxing Works

Automergent runs a sandboxed environment that restricts file writes and command execution to approved paths and commands. The sandbox operates at the tool-execution level — each write or shell operation is checked against a configurable allowlist.

  • File writes: Restricted to the current working directory and explicitly allowed paths.
  • Command execution: Only commands matching an allowlist pattern can run.
  • Network: Outbound network is unrestricted by default but can be limited via .opencode/sandbox.json.

🚫 What Gets Blocked by Default

  • Writes to system directories (/etc, /usr, /var)
  • Execution of destructive commands (rm -rf /, dd, mkfs)
  • Modifications to files outside the project directory
  • Sensitive file access (~/.ssh, ~/.aws/credentials)
  • Installation of system packages without explicit approval

📁 Configuring Write Paths

Add custom paths to the sandbox allowlist:

{
  "write": [
    "./src/**",
    "./tests/**",
    "./config/**",
    "/usr/local/lib/myproject/**"
  ],
  "commands": [
    "npm run *",
    "cargo test",
    "go test ./...",
    "pytest"
  ]
}

Place this in .opencode/sandbox.json at your project root.

🔐 Secrets Scanning Coverage

  • Automergent scans file diffs for patterns matching common secret formats (API keys, tokens, passwords).
  • Coverage includes: AWS keys, GitHub tokens, npm tokens, generic API keys, private keys.
  • Detected secrets are redacted from output and the user is warned.
  • Custom patterns can be added to .automergent/config.yaml.

🛠️ Dependency Audit Support

  • Automergent can run npm audit, cargo audit, govulncheck, or pip-audit via sub-agents.
  • Vulnerability reports are summarized with severity levels and remediation suggestions.
  • Configure automated audits in your CI workflow using /workflow.

Terminal Compatibility

🔵 Truecolor Support

Automergent uses truecolor (24-bit) for themes and diff rendering. Check support:

# Run in your terminal
echo -e "\e[38;2;255;100;0mTruecolor\e[0m"

# Or check via Automergent
/env   # look for "Truecolor: yes"
TerminalTruecolorNotes
iTerm2YesFull support
WezTermYesFull support
AlacrittyYesFull support
kitty / GhosttyYesFull support
Windows TerminalYesRequires Windows 10+
tmuxPartialRequires set -g default-terminal "xterm-256color"
screenNoFalls back to 256-color
cmd.exeNoUse Windows Terminal instead

✨ Unicode Rendering

  • Minimum: UTF-8 encoding with box-drawing characters.
  • Recommended: Full Unicode support including glyphs.
  • If characters render as ?? or boxes, set noAnimation: true or noColor: true in config.

📐 Minimum Terminal Size

Automergent requires a minimum of 80 columns × 24 rows. Recommended: 120×40 for optimal diff and code viewing. Use /env to check your current terminal dimensions.

Frequently Asked Questions

Automergent natively supports Google AI Studio (google-aistudio) and Google Vertex AI (google-vertex) as first-class backends. Any other OpenAI- or Gemini-compatible endpoint (OpenAI, Anthropic, DeepSeek, Ollama, vLLM, LiteLLM) connects through the custom provider.
Yes, if you point Automergent at a local inference server (such as Ollama, LocalAI, or vLLM) using the custom provider with baseUrl: "http://localhost:11434/v1". Automergent's models.dev catalog also maintains an offline fallback snapshot.
When you run /compact (or when automatic compaction triggers at autoCompressAt: 0.55), Automergent compresses session history into structured summaries preserving key decisions, file paths, open tasks, and active dependencies while freeing ~70–80% of token budget.
Yes. Create an AUTOMERGENT.md file in your project root with instructions, style conventions, or architecture patterns for the agent. The agent reads this file automatically on startup unless --no-context is specified.
Sub-agents are independent specialist sessions spawned by the main agent for parallel or specialized tasks (exploration, code reviews, deep builds). They receive scoped tool sets and return results to the main agent with real-time steering notifications. Monitor them with /agents.
Automergent is language-agnostic with AST-aware tree-sitter indexing and compiler error parsing across Go, TypeScript/JavaScript, Python, Rust, C/C++, Java, Ruby, PHP, and more.
Run curl -fsSL https://automergent.github.io/install.sh | bash or CGO_ENABLED=1 go install github.com/iSundram/Automergent/cmd/automergent@latest. Check your current version with automergent version or /version.