OpenCode error
OpenCode: Error: Unexpected error, check log file at...
Error: Unexpected error, check log file at [user-home]/.local/share/opencode/log/2025-08-26T215857.log for more detailsStatus: WorkaroundLast verified 4 documented fixes3 sources
What it means
A generic fatal error wrapper. The real cause is written to the log file named in the message. Examples from issues include an EACCES permission error (#2267) and ProviderModelNotFoundError (#916).
Causes
- Example from #2267:
EACCES: permission denied, open '[user-home]/.local/share/opencode/project/[project-path]/app.json'. - Example from #916: a fatal ProviderModelNotFoundError logged just before this message.
How to fix it
- Fix 1.
Read the log. Logs live in ~/.local/share/opencode/log/ (macOS/Linux) or %USERPROFILE%\.local\share\opencode\log (Windows), and the 10 most recent are kept. Run with --print-logs to see output in the terminal, or raise the log level.
Terminalopencode --print-logs opencode --log-level DEBUG - Fix 2.
Make sure you are on the latest version (official docs, "OpenCode won't start").
Terminalopencode upgrade - Fix 3.
For the permission error, a maintainer asked to inspect ownership of the file named in the log (#2267).
Snippetls -la ~/.local/share/opencode/project/[project-path]/app.json - Fix 4.
For a clean reinstall, the docs provide
opencode uninstall. A maintainer listed the data directories it uses (#2267).Terminalopencode uninstall # directories listed by a maintainer: # ~/.local/share/opencode ~/.cache/opencode ~/.local/state/opencode ~/.config/opencode
More OpenCode errors
All 17 OpenCode errorsProviderModelNotFoundErrorStatus: By designProviderInitErrorStatus: WorkaroundAI_APICallErrorStatus: WorkaroundThis credential is only authorized for use with Claude Code and cannot be used for other API requests.Status: By designAI_APICallError: messages.13: `tool_use` ids were found without `tool_result` blocks immediately after: toolu_01CfJCsh21fK1pAXsXWYJYBA, toolu_01NoqnwsaxoK3AYM2FyrxmjN. Each `tool_use` block must have a corresponding `tool_result` block in the next message.Status: Fixed in releasemessages.3.content.0.type: Expected `thinking` or `redacted_thinking`, but found `tool_use`. When `thinking` is enabled, a final `assistant` message must start with a thinking block (preceeding the lastmost set of `tool_use` and `tool_result` blocks). We recommend you include thinking blocks from previous turns. To avoid this requirement, disable `thinking`.Status: WorkaroundAI_RetryError: Failed after 4 attempts. Last error: Too Many RequestsStatus: Workaroundundefined: The provided model identifier is invalid.Status: Fixed in release
Related reading
- OpenCode Hacked: What the Console Breach Means for Your API KeysOpenCode disclosed a breach of its Console that may have exposed provider keys. Who is affected, what to rotate today, and why hosted key gateways are the real risk.
- OpenCode 2: How to Upgrade From v1 Without Breaking Your SetupOpenCode 2 upgrade from v1: what the migration guide says breaks (plugins, server API, TUI config), what carries over, and a safe checklist before you switch.
- Run Your Coding Agent as an API: OpenCode Server on RailwayOpenCode server on Railway: run opencode serve in a container as a password-protected HTTP API with a persistent volume, reachable from any machine or webhook.
- Give Every Agent PR a Live Preview: Railway Environments for AI Pull RequestsRailway preview environments for agent pull requests: an isolated copy of your whole stack for every PR, so you verify agent changes by running them.
- GPT-6 Astra Release Guide: Benchmarks, $10/$50 Pricing, and How to Run It in Codex and OpenCodeGPT-6 Astra release guide: OpenAI's max-capability model, its $10/$50 pricing and 1.05M context, what the benchmarks do and do not say, and commands to try it.
- Put an AI Reviewer on Every Pull Request: A Webhook Build with OpenCode and RailwayBuild an AI pull request reviewer on Railway: a webhook service runs OpenCode headless on every PR diff and posts findings as a review, never touching the code.
FAQ
What does "Error: Unexpected error, check log file at..." mean in OpenCode?
A generic fatal error wrapper. The real cause is written to the log file named in the message. Examples from issues include an EACCES permission error (#2267) and ProviderModelNotFoundError (#916).
How do I fix "Error: Unexpected error, check log file at..."?
There are 4 documented fixes. Start with the first: Read the log. Logs live in ~/.local/share/opencode/log/ (macOS/Linux) or %USERPROFILE%\.local\share\opencode\log (Windows), and the 10 most recent are kept. Run with --print-logs to see output in the terminal, or raise the log level.
Is this OpenCode error fixed?
Status: Workaround. No release removes the cause. The documented fixes work around it. Affected versions: Seen across versions (e.g. 0.4.45, 0.5.28).
Sources
Last verified against 3 sources: official docs, maintainer replies and release notes.
Newsletter
Fixes for the tools you use, weekly
One email per week. New coding agent releases, what broke, and how developers are working around it.