Automergent Troubleshooting & FAQ
Diagnose common issues, understand error codes, check terminal compatibility, and find answers to frequently asked questions.
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
connectionAutomergent cannot reach the AI provider API endpoint.
Error: Provider connection failed — could not reach api.example.com
- Verify your API key is configured: run
amt /envor checkGOOGLE_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_PROXYenvironment variables. - Check provider status pages for outages (Google AI Studio, Vertex AI, OpenAI).
Context Window Too Long
contextThe conversation context has exceeded the model's context window limit.
Error: CONTEXT_TOO_LONG — context window exceeded (198,000 / 128,000 tokens)
- Run
/compactto 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.
autoCompressAt: 0.55 (55% budget).
Tool Confirmation Keeps Appearing
permissionsThe approval prompt appears repeatedly for safe, routine operations.
- Switch approval mode:
/mode accept-editsor/mode auto(caution). - Configure permissions in
~/.automergent/config.yamlor.automergent/config.yaml. - Cycle approval modes anytime with
Shift+Tabin the terminal.
TUI Looks Broken
displayCharacters are garbled, colors missing, or layout is misaligned.
- Ensure your terminal supports truecolor (24-bit color). Run
/envto check. - Try a modern terminal: iTerm2, WezTerm, Alacritty, kitty, Ghostty, Windows Terminal.
- Set
TERM=xterm-256coloras a fallback. - Increase terminal window to at least 80×24 characters (recommended 120×40).
Build Fails
buildThe Go build fails with compilation or linking errors.
go build ./cmd/automergent: build constraints exclude all Go files or CGO-related errors.
- 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
gccormusl-gccfor CGO compilation. - On macOS, install Xcode Command Line Tools:
xcode-select --install
Session Not Saving
storageSession data is lost between runs or history is not persisted.
- Check session directory exists and is writable:
ls -la ~/.automergent/sessions/ - Ensure disk space is available:
df -h ~/.automergent/ - Run
automergent doctorto validate storage permissions.
Sub-Agent Not Responding
agentA spawned sub-agent appears stuck or never completes.
- Check agent status:
/agents— review active and completed agents in the fleet. - Cancel a stuck agent:
/cancel agent <id> - Use
/agents kill-allto terminate all stuck background subagents.
Theme Colors Look Wrong
themeColors are washed out, incorrect, or appear as solid blocks.
- Verify truecolor support:
/env— checkTruecolorfield. - 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
mcpCustom MCP servers fail to start or tools are not available.
- Check MCP config in
~/.automergent/config.yamlundermcp.serversfor 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
/mcpin the TUI to check server connectivity and registered dynamic tools.
Sandbox Blocking Legitimate Operations
sandboxFile writes or commands are blocked by the security sandbox.
- Check sandbox config in
.automergent/config.yaml. - Add allowed paths:
allowedWritePaths: [".", "/tmp/build"] - Run with
--no-sandboxor configuresandbox: autoin config. - Use
/doctorto see sandbox status and recent violations. - For debugging, run with
--no-sandboxflag (not recommended in production).
Diagnostics Commands
Built-in commands for runtime inspection and debugging.
| Command | Description | Use 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 |
/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
| Code | Description | Action |
|---|---|---|
| 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 Status | Error | Typical 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
/modelto switch mid-session based on task complexity.
📊 Context Management
- Run
/contextperiodically 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
/summaryto 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, orpip-auditvia 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"
| Terminal | Truecolor | Notes |
|---|---|---|
| iTerm2 | Yes | Full support |
| WezTerm | Yes | Full support |
| Alacritty | Yes | Full support |
| kitty / Ghostty | Yes | Full support |
| Windows Terminal | Yes | Requires Windows 10+ |
| tmux | Partial | Requires set -g default-terminal "xterm-256color" |
| screen | No | Falls back to 256-color |
| cmd.exe | No | Use 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, setnoAnimation: trueornoColor: truein 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
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.
custom provider with baseUrl: "http://localhost:11434/v1". Automergent's models.dev catalog also maintains an offline fallback snapshot.
/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.
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.
/agents.
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.