opencode-troubleshoot
Diagnose and fix OpenCode issues. Use when OpenCode won't start. sessions fail, MCP servers disconnect, plugins break, providers error, performance degrades, auth fails, configs conflict, or anything goes wrong with an OpenCode installation. Also use for proactive health checks, log analysis, session forensics, and deep diagnostics on any OpenCode CLI, Desktop, Web, or SDK deployment.
- License 许可
- MPL-2.0
- 最近更新
- 2026-11-13
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- opencode-troubleshoot
- updated
- 1778457600000
- description
- Diagnose and fix OpenCode issues. Use when OpenCode won't start. sessions fail, MCP servers disconnect, plugins break, providers error, performance degrades, auth fails, configs conflict, or anything goes wrong with an OpenCode installation. Also use for proactive health checks, log analysis, session forensics, and deep diagnostics on any OpenCode CLI, Desktop, Web, or SDK deployment.
- when_to_use
- Use this skill when users encounter runtime errors, configuration issues, authentication failures, performance problems, or need to perform proactive health checks and log analysis for OpenCode.
02 资源文件 9
- 参考文档references/config-diagnostics.md5.6 KB
- 参考文档references/filesystem-map.md5.6 KB
- 参考文档references/fixes.md8.8 KB
- 参考文档references/log-analysis.md4.6 KB
- 参考文档references/symptom-map.md6.2 KB
- 脚本scripts/oc-diag.sh13.0 KB
- 脚本scripts/oc-healthcheck.sh7.8 KB
- 脚本scripts/oc-log-analyzer.sh8.1 KB
- 脚本scripts/oc-session-inspector.sh9.9 KB
03 SKILL.md 正文
OpenCode Troubleshooting & Diagnostics
Deep diagnostic analysis and repair for OpenCode — the open-source AI coding agent.
Quick Reference: Key Paths
| Item | macOS / Linux | Windows |
|---|---|---|
| Data root | ~/.local/share/opencode/ |
%USERPROFILE%\.local\share\opencode |
| Logs | ~/.local/share/opencode/log/ |
%USERPROFILE%\.local\share\opencode\log |
| Auth | ~/.local/share/opencode/auth.json |
%USERPROFILE%\.local\share\opencode\auth.json |
| Sessions | ~/.local/share/opencode/project/<slug>/storage/ |
Same pattern under %USERPROFILE% |
| Global config | ~/.config/opencode/opencode.json (or .jsonc) |
%USERPROFILE%\.config\opencode\opencode.json |
| Project config | ./opencode.json (project root) |
Same |
| TUI config | ~/.config/opencode/tui.json |
Same pattern |
| Cache | ~/.cache/opencode/ |
%USERPROFILE%\.cache\opencode |
| Global plugins | ~/.config/opencode/plugins/ |
Same pattern |
| Project plugins | .opencode/plugins/ |
Same |
| Desktop app state | ~/Library/Application Support/ (macOS) |
%APPDATA% |
Diagnostic Workflow
When helping someone troubleshoot OpenCode, follow this sequence:
- Triage — identify the symptom category (see
references/symptom-map.md) - Collect — run
scripts/oc-diag.shfor automated environment snapshot - Analyze — check logs, config, auth, sessions using the reference guides
- Resolve — apply targeted fixes from
references/fixes.md - Verify — confirm the fix, run
scripts/oc-healthcheck.sh
Documentation Index
Core References:
references/symptom-map.md— symptom-to-cause lookup table for fast triagereferences/filesystem-map.md— complete directory/file layout with descriptionsreferences/log-analysis.md— how to read, filter, and interpret OpenCode logsreferences/config-diagnostics.md— config merge order, common mistakes, validationreferences/fixes.md— targeted fix procedures organized by error type
Diagnostic Scripts:
scripts/oc-diag.sh— full environment diagnostic snapshot (run first)scripts/oc-healthcheck.sh— quick pass/fail health checkscripts/oc-log-analyzer.sh— parse and summarize recent log filesscripts/oc-session-inspector.sh— inspect session history and storage
Key CLI Commands for Debugging
# Verbose startup
opencode --log-level DEBUG
opencode --print-logs
# Config inspection
opencode models # List available models
opencode models --refresh # Refresh model cache from models.dev
opencode auth list # Show authenticated providers
opencode mcp list # Show MCP server status
opencode session list # List sessions
opencode stats # Token usage and cost stats
opencode stats --days 7 # Last 7 days of stats
opencode export <sessionID> # Export session as JSON for analysis
# MCP debugging
opencode mcp debug <server> # Debug specific MCP server
opencode mcp auth <server> # Re-authenticate OAuth MCP
opencode mcp auth list # Show OAuth status for all MCP servers
# Recovery
opencode upgrade # Update to latest version
opencode uninstall --dry-run # See what would be removed
Key Environment Variables
| Variable | Purpose |
|---|---|
OPENCODE_CONFIG |
Custom config file path |
OPENCODE_CONFIG_DIR |
Custom config directory |
OPENCODE_CONFIG_CONTENT |
Inline JSON config override |
OPENCODE_PORT |
Server port (can conflict with Desktop) |
OPENCODE_SERVER_PASSWORD |
HTTP basic auth for serve/web |
OPENCODE_DISABLE_AUTOUPDATE |
Skip update checks |
OPENCODE_DISABLE_DEFAULT_PLUGINS |
Disable built-in plugins |
OPENCODE_DISABLE_LSP_DOWNLOAD |
Skip automatic LSP downloads |
OPENCODE_DISABLE_AUTOCOMPACT |
Disable context compaction |
OPENCODE_DISABLE_PRUNE |
Disable old data pruning |
OPENCODE_DISABLE_CLAUDE_CODE |
Disable .claude prompt/skill reading |
OPENCODE_PERMISSION |
Inline JSON permission config |
Plugin Logging
Plugins should use structured logging via the SDK client:
await client.app.log({
body: {
service: "my-plugin",
level: "debug", // debug \| info \| warn \| error
message: "Diagnostic message",
extra: { key: "value" }
}
})
This writes to the standard log directory and appears in --print-logs output.
Official Resources
| Resource | URL |
|---|---|
| Docs | https://opencode.ai/docs/ |
| Troubleshooting | https://opencode.ai/docs/troubleshooting/ |
| CLI Reference | https://opencode.ai/docs/cli/ |
| Config Reference | https://opencode.ai/docs/config/ |
| GitHub Issues | https://github.com/anomalyco/opencode/issues |
| Discord | https://opencode.ai/discord |
| Plugin Docs | https://opencode.ai/docs/plugins/ |
| MCP Server Docs | https://opencode.ai/docs/mcp-servers/ |
04 同仓库更多 Skills
tax-filing-checklist
Walk through the steps and documents needed to file an individual federal income tax return
patient-vitals-charting
Record patient vital signs consistently and flag values outside the normal reference range
pasta-from-scratch
Make fresh egg pasta dough from scratch, roll it, and cut it into shapes
knife-sharpening
Sharpen and hone kitchen knives to keep an edge safe and effective
first-aid-response
Respond to a first aid emergency using a scene-safety-first, ABC-based (airway, breathing, circulation) approach
contract-review-basics
Review a contract draft for missing terms, ambiguous language, and risky clauses before signing