However, the command fails to run because the directory is apparently not found.
Even though the directory exists at that location when checked manually.
INFO 2025-08-11T13:36:40 +149ms service=default version=0.4.16 args=["auth","login"] opencode
INFO 2025-08-11T13:36:40 +2ms service=models.dev file={} refreshing
INFO 2025-08-11T13:36:41 +679ms service=models.dev file={} refreshing
INFO 2025-08-11T13:37:12 +32206ms service=app cwd=/home/t-hash06 creating
INFO 2025-08-11T13:37:12 +1ms service=app git
INFO 2025-08-11T13:37:12 +0ms service=bus type=storage.write subscribing
INFO 2025-08-11T13:37:12 +0ms service=app name=bus registering service
INFO 2025-08-11T13:37:12 +0ms service=format init
INFO 2025-08-11T13:37:12 +0ms service=bus type=file.edited subscribing
INFO 2025-08-11T13:37:12 +0ms service=bus type=* subscribing
INFO 2025-08-11T13:37:12 +0ms service=config.hooks init
INFO 2025-08-11T13:37:12 +0ms service=bus type=file.edited subscribing
INFO 2025-08-11T13:37:12 +1ms service=bus type=session.idle subscribing
INFO 2025-08-11T13:37:12 +0ms service=app name=lsp registering service
INFO 2025-08-11T13:37:12 +0ms service=app name=config registering service
INFO 2025-08-11T13:37:12 +0ms service=app name=provider registering service
INFO 2025-08-11T13:37:12 +2ms service=config agent={} mode={} plugin=[] username=t-hash06 loaded
INFO 2025-08-11T13:37:12 +0ms service=models.dev file={} refreshing
INFO 2025-08-11T13:37:12 +4ms service=provider init
INFO 2025-08-11T13:37:12 +2ms service=provider providerID=github-copilot found
INFO 2025-08-11T13:37:12 +16ms service=default cmd=["~/.cache/opencode/tui/tui-b7km8azh."] tui
INFO 2025-08-11T13:37:12 +1ms service=app name=agent registering service
INFO 2025-08-11T13:37:12 +85ms service=server method=GET path=/config request
INFO 2025-08-11T13:37:12 +1ms service=server duration=1 response
INFO 2025-08-11T13:37:12 +15ms service=server method=GET path=/file/status request
INFO 2025-08-11T13:37:12 +2ms service=server duration=2 response
INFO 2025-08-11T13:37:12 +2ms service=server method=GET path=/config/providers request
INFO 2025-08-11T13:37:12 +2ms service=server duration=2 response
INFO 2025-08-11T13:37:12 +1ms service=server method=GET path=/tui/control/next request
INFO 2025-08-11T13:37:12 +1ms service=server method=GET path=/event request
INFO 2025-08-11T13:37:12 +0ms service=server event connected
INFO 2025-08-11T13:37:12 +6ms service=bus type=* subscribing
INFO 2025-08-11T13:37:12 +4ms service=server duration=10 response
INFO 2025-08-11T13:37:12 +4ms service=tui commands={"agent_list":{},"app_exit":{},"app_help":{},"editor_open":{},"file_close":{},"file_diff_toggle":{},"file_search":{},"input_clear":{},"input_newline":{},"input_paste":{},"input_submit":{},"messages_copy":{},"messages_first":{},"messages_half_page_down":{},"messages_half_page_up":{},"messages_last":{},"messages_layout_toggle":{},"messages_next":{},"messages_page_down":{},"messages_page_up":{},"messages_previous":{},"messages_redo":{},"messages_undo":{},"model_cycle_recent":{},"model_list":{},"project_init":{},"session_compact":{},"session_export":{},"session_interrupt":{},"session_list":{},"session_new":{},"session_share":{},"session_unshare":{},"switch_agent":{},"switch_agent_reverse":{},"theme_list":{},"tool_details":{}} Loaded commands
INFO 2025-08-11T13:37:16 +3841ms service=server method=POST path=/session request
INFO 2025-08-11T13:37:16 +2ms service=session id=ses_766a67f01ffeV2qHkCMVH88FhI version=0.4.16 title=New session - 2025-08-11T13:37:16.542Z time={"created":1754919436543,"updated":1754919436543} created
INFO 2025-08-11T13:37:16 +0ms service=app name=session registering service
INFO 2025-08-11T13:37:16 +0ms service=app name=storage registering service
INFO 2025-08-11T13:37:16 +1ms service=storage index=0 running migration
INFO 2025-08-11T13:37:16 +0ms service=storage index=1 running migration
INFO 2025-08-11T13:37:16 +1ms service=storage index=2 running migration
INFO 2025-08-11T13:37:16 +1ms service=bus type=storage.write publishing
INFO 2025-08-11T13:37:16 +1ms service=app name=plugin registering service
INFO 2025-08-11T13:37:16 +1ms service=bus type=session.updated publishing
INFO 2025-08-11T13:37:16 +1ms service=server duration=8 response
INFO 2025-08-11T13:37:16 +5ms service=server method=POST path=/session/ses_766a67f01ffeV2qHkCMVH88FhI/message request
INFO 2025-08-11T13:37:16 +9ms service=session session=ses_766a67f01ffeV2qHkCMVH88FhI chatting
INFO 2025-08-11T13:37:16 +9ms service=bus type=storage.write publishing
INFO 2025-08-11T13:37:16 +1ms service=bus type=message.updated publishing
INFO 2025-08-11T13:37:16 +2ms service=bus type=storage.write publishing
INFO 2025-08-11T13:37:16 +0ms service=bus type=message.part.updated publishing
INFO 2025-08-11T13:37:16 +2ms service=bus type=storage.write publishing
INFO 2025-08-11T13:37:16 +1ms service=bus type=session.updated publishing
INFO 2025-08-11T13:37:16 +1ms service=provider providerID=github-copilot modelID=gpt-4.1 getModel
INFO 2025-08-11T13:37:16 +0ms service=provider status=started providerID=github-copilot getSDK
INFO 2025-08-11T13:37:16 +2ms service=bun pkg=@ai-sdk/openai-compatible version=latest installing package using Bun's default registry resolution
INFO 2025-08-11T13:37:16 +0ms service=bun cmd=["/usr/bin/opencode","add","--force","--exact","--cwd","~/.cache/opencode","@ai-sdk/openai-compatible@latest"] cwd=~/.cache/opencode running
INFO 2025-08-11T13:37:16 +12ms service=bun code=1 stdout= stderr=error: failed to change directory to "~/.cache/opencode": ENOENT
done
INFO 2025-08-11T13:37:16 +1ms service=provider status=completed duration=15 providerID=github-copilot getSDK
INFO 2025-08-11T13:37:16 +4ms service=server duration=44 response
ERROR 2025-08-11T13:37:16 +7ms service=tui failed to send message: POST "http://127.0.0.1:34123/session/ses_766a67f01ffeV2qHkCMVH88FhI/message": 400 Bad Request {"name":"ProviderInitError","data":{"providerID":"github-copilot"}}
INFO 2025-08-11T13:37:19 +2818ms service=bus type=* unsubscribing
INFO 2025-08-11T13:37:19 +0ms service=server event disconnected
INFO 2025-08-11T13:37:19 +2ms service=app name=lsp shutdown
INFO 2025-08-11T13:37:19 +0ms service=app name=session shutdown
When using the
opencodeCLI, it fails during startup with anENOENTerror related to the--cwdargument passed tobun. The path provided is~/.cache/opencode, and the directory does exist on the file system.However, the command fails to run because the directory is apparently not found.
Expected Behavior
opencodeshould correctly resolve and use the working directory if it exists.Actual Behavior
The CLI fails with an error like:
error: failed to change directory to "~/.cache/opencode": ENOENTEven though the directory exists at that location when checked manually.
Environment
Relevant Logs