GeezerVison is showing github.com — Error: Unexpected error, check log file at · Issue #387 · anomalyco/opencode
Error: Unexpected error, check log file at #387DescriptionINFO 2025-06-25T09:09:30 +45ms service=default version=0.1.133 args=run,Explain,the,use,of,context,in,Go opencode
INFO 2025-06-25T09:09:30 +1ms service=app cwd=/Users/zheng-cheng/Documents/MiraclePlus/mp creating
INFO 2025-06-25T09:09:30 +6ms service=app git=/Users/zheng-cheng/Documents/MiraclePlus/mp git
INFO 2025-06-25T09:09:30 +2ms service=app name=share registering service
INFO 2025-06-25T09:09:30 +0ms service=bus type=storage.write subscribing
INFO 2025-06-25T09:09:30 +0ms service=app name=bus registering service
INFO 2025-06-25T09:09:30 +2ms service=session id=ses_859a6870affe2vKYl9mgW0nV1P version=0.1.133 title=New Session - 2025-06-25T09:09:30.998Z time=[object Object] created
INFO 2025-06-25T09:09:30 +0ms service=app name=session registering service
INFO 2025-06-25T09:09:30 +0ms service=app name=storage registering service
INFO 2025-06-25T09:09:30 +0ms service=storage path=/Users/zheng-cheng/.local/share/opencode/project/Users-zheng-cheng-Documents-MiraclePlus-mp/storage init
INFO 2025-06-25T09:09:30 +1ms service=bus type=storage.write publishing
INFO 2025-06-25T09:09:30 +0ms service=app name=config registering service
INFO 2025-06-25T09:09:31 +2ms service=config loaded
INFO 2025-06-25T09:09:31 +0ms service=bus type=session.updated publishing
INFO 2025-06-25T09:09:31 +0ms service=app name=provider registering service
INFO 2025-06-25T09:09:31 +2ms service=models.dev refreshing
INFO 2025-06-25T09:09:31 +1ms service=provider init
ERROR 2025-06-25T09:09:31 +14ms service=default fatal

Reacted by ryan dushane, Wendell Misiedjan, Haris Causegic and Semyon Pupkov Activity1c7 commented on Jun 25, 2025 Hi, I am trying to run OpenCode in my macbook, it doesn't work and I can't figure out why, the error log is not helping 1c7 commented on Jun 25, 2025 ~/.local/share/opencode/auth.json
 1c7 commented on Jun 25, 2025 cravenceiling commented on Jun 25, 2025 Try again after upgrading opencode. Do you have a config.json or opencode.json file? 1c7 commented on Jun 25, 2025 Latest version is 0.1.135
I am using Warp 2.0 terminal
Thank you for reply! I don't have config.json or opencode.json file1c7 commented on Jun 25, 2025 it still output error message
Error: Unexpected error, check log file at /Users/zheng-cheng/.local/share/opencode/log/2025-06-25T135750.log for more details
/Users/zheng-cheng/.local/share/opencode/log/2025-06-25T135750.log
INFO 2025-06-25T13:57:50 +33ms service=default version=0.1.135 args=run,hi opencode
INFO 2025-06-25T13:57:50 +2ms service=app cwd=/Users/zheng-cheng/Desktop/cursor_for_qiji creating
INFO 2025-06-25T13:57:50 +0ms service=app git=/Users/zheng-cheng/Desktop/cursor_for_qiji git
INFO 2025-06-25T13:57:50 +1ms service=app name=share registering service
INFO 2025-06-25T13:57:50 +0ms service=bus type=storage.write subscribing
INFO 2025-06-25T13:57:50 +0ms service=app name=bus registering service
INFO 2025-06-25T13:57:50 +1ms service=session id=ses_8589e8e3cffedzb74m1h6AUpW8 version=0.1.135 title=New Session - 2025-06-25T13:57:50.659Z time=[object Object] created
INFO 2025-06-25T13:57:50 +0ms service=app name=session registering service
INFO 2025-06-25T13:57:50 +0ms service=app name=storage registering service
INFO 2025-06-25T13:57:50 +0ms service=storage path=/Users/zheng-cheng/.local/share/opencode/project/Users-zheng-cheng-Desktop-cursor_for_qiji/storage init
INFO 2025-06-25T13:57:50 +1ms service=bus type=storage.write publishing
INFO 2025-06-25T13:57:50 +0ms service=app name=config registering service
INFO 2025-06-25T13:57:50 +1ms service=config loaded
INFO 2025-06-25T13:57:50 +0ms service=bus type=session.updated publishing
INFO 2025-06-25T13:57:50 +0ms service=app name=provider registering service
INFO 2025-06-25T13:57:50 +2ms service=models.dev refreshing
INFO 2025-06-25T13:57:50 +0ms service=provider init
ERROR 2025-06-25T13:57:50 +6ms service=default fatal
1c7 commented on Jun 25, 2025 thdxr commented on Jun 25, 2025 what is the result of opencode models 1c7 commented on Jun 26, 2025 1c7 commented on Jun 26, 2025 just error and nothing else ItsWendell commented on Jun 26, 2025 Similar issue here on Linux (Fedora), running latest version (0.1.140).
opencode --version -> Works: 0.1.140
opencode models -> Error
opencode -> Error
Logs:
INFO 2025-06-26T12:30:07 +27ms service=default version=0.1.140 args= opencode
INFO 2025-06-26T12:30:07 +1ms service=app cwd=[HIDDEN] creating
INFO 2025-06-26T12:30:07 +2ms service=app git=[HIDDEN] git
INFO 2025-06-26T12:30:07 +0ms service=app name=provider registering service
INFO 2025-06-26T12:30:07 +1ms service=app name=config registering service
INFO 2025-06-26T12:30:07 +1ms service=config $schema=https://opencode.ai/config.json theme=opencode model=google/gemini-2.5-pro autoshare=false autoupdate=true loaded
INFO 2025-06-26T12:30:07 +1ms service=models.dev refreshing
INFO 2025-06-26T12:30:07 +0ms service=provider init
ERROR 2025-06-26T12:30:07 +3ms service=default fatal
Relevant environment variables set:
- GEMINI_API_KEY
PATH=/home/[HIDDEN]/.opencode/bin:$PATH
- ANTHROPIC_MODEL='us.anthropic.claude-sonnet-4-20250514-v1:0'
- ANTHROPIC_SMALL_FAST_MODEL='us.anthropic.claude-3-5-haiku-20241022-v1:0'
- CLAUDE_CODE_USE_BEDROCK=1
- AWS_REGION=us-east-1
- AWS_PROFILE=claude-code
thdxr commented on Jun 26, 2025 hm this is really weird - is it possible for you to run the repo locally and dig in more? thdxr commented on Jun 26, 2025 it's failing some point after the provider.ts init 1c7 commented on Jun 27, 2025 is it possible the bug relate to network / proxy?
I am in Guangzhou China, we use VPN (shadowsocks, Clash etc) to visit Google/Youtube/Github etc.
I have HTTP proxy running at port 1087 and set env variable like this
export http_proxy=http://127.0.0.1:1087;
export https_proxy=http://127.0.0.1:1087;
1c7 commented on Jun 27, 2025 somehow it works on my 2022 Macbook Air(M2 chip with 24G memory),
but not macbook pro(M1 Pro chip with 16G memory) 1c7 commented on Jun 27, 2025 is there verbose mode I can enable? --verbose cravenceiling commented on Jun 27, 2025 You can use --print-logs to get more info when running opencode. Reacted by Cheng Zheng(郑诚) ItsWendell commented on Jun 27, 2025 Quick fix for people running into this issue and want to continue using opencode: In the folder ~/.local/share/opencode, delete package.json or the whole folder
Example: rm -rf ~/.local/share/opencode/package.json or ~/.local/share/opencode
--
@thdxr I've ran this locally and located the primary issue here:
ERROR 2025-06-27T15:01:16 +2ms service=default name=ResolveMessage message=Cannot find module '/home/wmisiedjan/.cache/opencode/node_modules/@aws-sdk/credential-providers' from '/home/wmisiedjan/Projects/opencode/packages/opencode/src/provider/provider.ts' code=ERR_MODULE_NOT_FOUND specifier=/home/wmisiedjan/.cache/opencode/node_modules/@aws-sdk/credential-providers referrer=/home/wmisiedjan/Projects/opencode/packages/opencode/src/provider/provider.ts importKind=import-statement fatal
I'm preparing a PR to update error handling for these cases.
Here's a rough analysis of actual issue. I started checking out packages/opencode/src/bun/index.ts (BunProc)'s install function, where it detects @aws-sdk/credential-providers already within the package.json file, it thus skips installation the installation. But it's not actually installed in the node_modules folder of the cache dir.
After that, I tried always installing all packages (essentially removing the check if it's listed in package.json), that causes issues with the BunProc's run, function because how we read stdout and stdin is broken.
We can fix that by doing the following instead:
const stdout = result.stdout ? typeof result.stdout === "number" ? result.stdout : await readableStreamToText(result.stdout) : undefined
const stderr = result.stderr ? typeof result.stderr === "number" ? result.stderr : await readableStreamToText(result.stderr) : undefined
Once that is fixed, the following problem happened for me, somehow, also "amazon-bedrock" is listed for me as dependencies in the cache package.json file, but this package doesn't exist, which causes the installation to occur:
INFO 2025-06-27T15:21:53 +2ms service=bun cmd=/home/wmisiedjan/.bun/bin/bun,install,--registry=https://registry.npmjs.org cwd=/home/wmisiedjan/.cache/opencode running
INFO 2025-06-27T15:21:53 +60ms service=bun code=1 stdout=bun install v1.2.17 (282dda62)
stderr=Resolving dependencies
Resolved, downloaded and extracted [1]
error: GET https://registry.npmjs.org/amazon-bedrock - 404
error: amazon-bedrock@latest failed to resolve
done
ERROR 2025-06-27T15:21:53 +1ms service=default pkg=@aws-sdk/credential-providers version=latest name=BunInstallFailedError message=BunInstallFailedError cause=Error: Command failed with exit code 1 fatal
Likely cause is in that there was some mistake in earlier versions that caused the state of the cache's package.json to be broken, this also uncovered a couple of other bugs mentioned above.
We need strategy to how we deal with a broken package.json state / cache, e.g. automatically delete when broken state occurs, a clean command or something along those lines. Reacted by Cheng Zheng(郑诚) ItsWendell commented on Jun 27, 2025 The following PR improves error handling and the parsing of stdout / stdin:
We still need a solution for resolving broken cache package.json files, @thdxr woud love to hear your thoughts on this. rekram1-node commented on Dec 28, 2025 [automated] Closing due to 90+ days of inactivity. Feel free to reopen if you still need this!
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|