OpenCode Log Investigation
Quick start
- Identify the latest log file:
- Windows:
%USERPROFILE%\.local\share\opencode\log\ - Linux/macOS:
~/.local/share/opencode/log/
- Windows:
- Open the most recent
YYYY-MM-DDTHHMMSS.log. - Search for
ERRORlines to find the root cause.
Workflows
1. Plugin loading issues
- Search for
service=pluginin the log. - Check if the target plugin appears as
loading plugin. - If absent, verify
opencode.jsonhas the plugin in thepluginarray. - If present but errors follow, inspect the stack trace immediately after the load line.
2. MCP server failures
- Search for
service=mcpandERROR. - Common errors:
MCP error -32000: Connection closed→ the command failed to start.The system cannot find the path specified→ the executable (e.g.,/bin/bash,uvx) is missing or not in PATH.
- Check the
command=field in the error line to see the exact command invoked.
3. Session or tool errors
- Search for
service=sessionorservice=tool.registry. - Look for
error=orfailedin the same block. - Cross-reference timestamps to match user-visible terminal errors with log entries.
4. Shell command errors inside plugins
- If a plugin uses
ctx.$to run shell commands,console.erroroutput from the plugin may not appear in the OpenCode log. - Check the terminal output directly, or redirect plugin stderr to a temp file for debugging.
- Verify the command exists in the OS PATH (e.g.,
python3vspythonon Windows).
Advanced features
- See REFERENCE.md for a detailed error pattern catalog.
- For plugin-specific debugging, add
console.login the plugin and watch the terminal; OpenCode does not capture plugin stdout/stderr into its log file.