opencode icon indicating copy to clipboard operation
opencode copied to clipboard

"Failed to send message" error when doing any type of prompt

Open SunP04 opened this issue 1 year ago • 22 comments

When trying to send a basic prompt, while in either mode (plan or agent), the tui showed this error:

Image

That shows up on every prompt, meaning something has crashed internally, but no logs on the console were created and the application did not crash.

When trying app commands, like /init, the application just does nothing

Image

System Info:

  • Opencode Version: 0.15.0 (installed via scoop)
  • OS: Windows 11
  • Terminal Emulator: Wezterm
  • Shell: nushell

SunP04 avatar Oct 13 '25 17:10 SunP04

This issue might be a duplicate of existing issues. Please check:

  • #1713: tui failed to send message: RipgrepExtractionFailedError - Similar "failed to send message" error with TUI, also related to dependency issues
  • #2620: failed to send message: POST - Same "failed to send message" error pattern with HTTP POST failures
  • #942: failed to send message: POST - Another identical "failed to send message" error with HTTP 400 responses
  • #3141: Fix for windows rendering and scrolling - Specifically addresses Windows rendering issues which might be related to your display problems
  • #631: Windows Support - General Windows compatibility tracking issue that covers various Windows-specific problems

Feel free to ignore if none of these address your specific case.

github-actions[bot] avatar Oct 13 '25 17:10 github-actions[bot]

Just tested on a previous version (pre 0.15), it worked normally

Image

Was there any breaking changes on 0.15 that could potentially impact on this?

SunP04 avatar Oct 13 '25 18:10 SunP04

Could be related to #3109 if you have custom tools or custom plugins. If that's the case, try installing your dependencies.

arsham avatar Oct 13 '25 22:10 arsham

@SunP04 can you run:

opencode run hello --print-logs

and show output?

rekram1-node avatar Oct 13 '25 22:10 rekram1-node

Could be related to #3109 if you have custom tools or custom plugins. If that's the case, try installing your dependencies.

I have no extra plugins or configurations, I don't even have a api key setup

@SunP04 can you run:

opencode run hello --print-logs

and show output?

I don't know where the log file is bc it doesn't say, but here's the output

Image

With the 0.14.* version it works properly, showing hello after a lot of stuff (not gonna show here bc it's a lot)

SunP04 avatar Oct 14 '25 00:10 SunP04

This is helpful thank you! hope to fix this for you

In the meantime you may want to edit your opencode.json and set:

{
  "$schema": "https://opencode.ai/config.json",
  "autoupdate": false
}

That way you can stay downgraded and then upgrade manually using opencode upgrade

rekram1-node avatar Oct 14 '25 00:10 rekram1-node

I am having the same issue. At the bottom is the output of opencode run hello --print-logs command. Downgrade to v0.14.7 fix the issue.

System Info

  • os: windows11 24H2
  • term: wezterm
  • shell: nushell
command output
╭  nu  …\obsidian   main !                                                                                           16s847ms  win 21:09
╰─ opencode run hello --print-logs
INFO  2025-10-14T13:09:58 +137ms service=default version=0.15.2 args=["run","hello","--print-logs"] opencode
INFO  2025-10-14T13:09:58 +1ms service=project directory=C:\Users\noid\.local\share\obsidian fromDirectory
INFO  2025-10-14T13:09:59 +306ms service=config path=C:\Users\noid\.config\opencode\config.json loading
INFO  2025-10-14T13:09:59 +0ms service=config path=C:\Users\noid\.config\opencode\opencode.json loading
INFO  2025-10-14T13:09:59 +7ms service=config path=C:\Users\noid\.config\opencode\opencode.jsonc loading
INFO  2025-10-14T13:09:59 +7ms service=bun cmd=["C:\\Users\\noid\\scoop\\apps\\opencode\\0.15.2\\opencode.exe","add","@opencode-ai/[email protected]","--exact"] cwd=C:\Users\noid\.config\opencode running
INFO  2025-10-14T13:09:59 +20ms service=plugin [email protected] loading plugin
INFO  2025-10-14T13:09:59 +3ms service=plugin [email protected] loading plugin
INFO  2025-10-14T13:09:59 +38ms service=bus type=* subscribing
INFO  2025-10-14T13:09:59 +0ms service=bus type=session.updated subscribing
INFO  2025-10-14T13:09:59 +1ms service=bus type=message.updated subscribing
INFO  2025-10-14T13:09:59 +0ms service=bus type=message.part.updated subscribing
INFO  2025-10-14T13:09:59 +0ms service=format init
INFO  2025-10-14T13:09:59 +0ms service=bus type=file.edited subscribing
INFO  2025-10-14T13:09:59 +4ms service=session id=ses_61d287accffeKBPUJDTSMQjWMq version=0.15.2 projectID=c3ef6915bb3696344facc96310652f1842c7a3cc directory=C:\Users\noid\.local\share\obsidian title=New session - 2025-10-14T13:09:59.219Z time={"created":1760447399219,"updated":1760447399219} created
INFO  2025-10-14T13:09:59 +1ms service=lsp serverIds=typescript, vue, eslint, gopls, ruby-lsp, pyright, elixir-ls, zls, csharp, rust, clangd, svelte, jdtls enabled LSP servers
ERROR 2025-10-14T13:09:59 +0ms service=default e=ENOTCONN: socket is not connected, open rejection
INFO  2025-10-14T13:09:59 +1ms service=bus type=session.updated publishing
INFO  2025-10-14T13:09:59 +3ms service=bus type=message.part.updated subscribing
INFO  2025-10-14T13:09:59 +0ms service=bus type=session.error subscribing
INFO  2025-10-14T13:09:59 +1ms service=session.prompt session=ses_61d287accffeKBPUJDTSMQjWMq prompt
INFO  2025-10-14T13:09:59 +8ms service=bus type=message.updated publishing
INFO  2025-10-14T13:09:59 +2ms service=bus type=message.part.updated publishing
INFO  2025-10-14T13:09:59 +1ms service=bus type=session.updated publishing
INFO  2025-10-14T13:09:59 +3ms service=models.dev file={} refreshing
INFO  2025-10-14T13:09:59 +3ms service=provider init
INFO  2025-10-14T13:09:59 +3ms service=provider providerID=anthropic found
INFO  2025-10-14T13:09:59 +0ms service=provider providerID=opencode found
INFO  2025-10-14T13:09:59 +0ms service=provider providerID=anthropic modelID=claude-sonnet-4-5-20250929 getModel
INFO  2025-10-14T13:09:59 +1ms service=provider status=started providerID=anthropic getSDK
INFO  2025-10-14T13:09:59 +160ms service=provider status=completed duration=160 providerID=anthropic getSDK
INFO  2025-10-14T13:09:59 +0ms service=provider providerID=anthropic modelID=claude-sonnet-4-5-20250929 found
INFO  2025-10-14T13:09:59 +1ms service=session.prompt session=ses_61d287accffeKBPUJDTSMQjWMq sessionID=ses_61d287accffeKBPUJDTSMQjWMq locking
INFO  2025-10-14T13:09:59 +1ms service=session.prompt session=ses_61d287accffeKBPUJDTSMQjWMq sessionID=ses_61d287accffeKBPUJDTSMQjWMq unlocking
ERROR 2025-10-14T13:09:59 +5ms service=default name=Error message=ENOTCONN: socket is not connected, open stack=Error: ENOTCONN: socket is not connected, open
    at spawn (unknown)
    at files (B:/~BUN/root/index.js:87510:27)
    at processTicksAndRejections (native:7:39) fatal
Error: Unexpected error, check log file at  for more details
INFO  2025-10-14T13:09:59 +13ms service=bus type=session.idle publishing
INFO  2025-10-14T13:10:03 +3844ms service=bun code=0 stdout=bun add v1.3.0 (b0a6feca)

installed @opencode-ai/[email protected]

2 packages installed [4.08s]
 stderr=Resolving dependencies
Resolved, downloaded and extracted [8]
Saved lockfile
 done

Besides, I am also experiencing the same issue with Issue #23530 · oven-sh/bun after upgrading to bun v1.3, and downgrade to previous version also fix the issue.

noidilin avatar Oct 14 '25 13:10 noidilin

oo thanks, likely an issue with bun 1.3 as you pointed out, good to know

rekram1-node avatar Oct 14 '25 15:10 rekram1-node

This is helpful thank you! hope to fix this for you

In the meantime you may want to edit your opencode.json and set:

{
  "$schema": "https://opencode.ai/config.json",
  "autoupdate": false
}

That way you can stay downgraded and then upgrade manually using opencode upgrade

That's not a problem, since I'm using scoop I can just downgrade as needed

SunP04 avatar Oct 15 '25 21:10 SunP04

I found that as long as there is a .git folder in the current directory, this issue occurs. After deleting it, everything returns to normal.

Image

TangTangH avatar Oct 16 '25 04:10 TangTangH

Hm that's weird...

what if you set "snapshot": false in your opencode.json but still have .git

rekram1-node avatar Oct 16 '25 04:10 rekram1-node

Removing .git dir allows the session to proceed

With .git dir removed, the same error is being thrown as part of the reply like this:

reply after removing .git dir
     I'll examine the GitHub Actions workflow files to explain how they work in this repo.
     Plan claude-sonnet-4-5-20250929 (04:10 PM)


  ┃                                                                                                                                      ┃
  ┃  List C:\Users\noid\hub\dev\scoop-action                                                                                             ┃
  ┃                                                                                                                                      ┃
  ┃                                                                                                                                      ┃
  ┃                                                                                                                                      ┃
  ┃  Error: ENOTCONN: socket is not connected, open                                                                                      ┃
  ┃                                                                                                                                      ┃

Apart from this error occasionally popping up, opencode runs normally.

command output of `opencode run hello --print-logs`
INFO  2025-10-16T08:28:55 +121ms service=default version=0.15.3 args=["run","hello","--print-logs"] opencode
INFO  2025-10-16T08:28:55 +1ms service=project directory=C:\Users\noid\hub\dev\scoop-action fromDirectory
INFO  2025-10-16T08:28:55 +13ms service=config path=C:\Users\noid\.config\opencode\config.json loading
INFO  2025-10-16T08:28:55 +0ms service=config path=C:\Users\noid\.config\opencode\opencode.json loading
INFO  2025-10-16T08:28:55 +8ms service=config path=C:\Users\noid\.config\opencode\opencode.jsonc loading
INFO  2025-10-16T08:28:55 +4ms service=bun cmd=["C:\\Users\\noid\\scoop\\apps\\opencode\\0.15.3\\opencode.exe","add","@opencode-ai/[email protected]","--exact"] cwd=C:\Users\noid\.config\opencode running
INFO  2025-10-16T08:28:55 +18ms service=plugin [email protected] loading plugin
INFO  2025-10-16T08:28:55 +3ms service=plugin [email protected] loading plugin
INFO  2025-10-16T08:28:55 +39ms service=bus type=* subscribing
INFO  2025-10-16T08:28:55 +0ms service=bus type=session.updated subscribing
INFO  2025-10-16T08:28:55 +0ms service=bus type=message.updated subscribing
INFO  2025-10-16T08:28:55 +0ms service=bus type=message.part.updated subscribing
INFO  2025-10-16T08:28:55 +0ms service=format init
INFO  2025-10-16T08:28:55 +0ms service=bus type=file.edited subscribing
INFO  2025-10-16T08:28:55 +5ms service=session id=ses_613dd1343ffedm9ZKdNABsGg0O version=0.15.3 projectID=global directory=C:\Users\noid\hub\dev\scoop-action title=New session - 2025-10-16T08:28:55.868Z time={"created":1760603335868,"updated":1760603335868} created
INFO  2025-10-16T08:28:55 +1ms service=lsp serverIds=typescript, vue, eslint, gopls, ruby-lsp, pyright, elixir-ls, zls, csharp, rust, clangd, svelte, jdtls enabled LSP servers
ERROR 2025-10-16T08:28:55 +0ms service=default e=ENOTCONN: socket is not connected, open rejection
INFO  2025-10-16T08:28:55 +6ms service=bun code=0 stdout=bun add v1.3.0 (b0a6feca)

installed @opencode-ai/[email protected]

[14.00ms] done
 stderr=Saved lockfile
 done
INFO  2025-10-16T08:38:52 +1ms service=bus type=session.updated publishing
INFO  2025-10-16T08:38:52 +3ms service=bus type=message.part.updated subscribing
INFO  2025-10-16T08:38:52 +0ms service=bus type=session.error subscribing
INFO  2025-10-16T08:38:52 +1ms service=session.prompt session=ses_613d3f80effei4oV9WFQMgRhZM prompt
INFO  2025-10-16T08:38:52 +9ms service=bus type=message.updated publishing
INFO  2025-10-16T08:38:52 +2ms service=bus type=message.part.updated publishing
INFO  2025-10-16T08:38:52 +2ms service=bus type=session.updated publishing
# ...

Setting snapshot to false without removing .git dir didn't fix the issue

Opencode revert back to the previously behavior (hang with error message).

Besides, /sessions won't list the session I created when .git dir is removed after I restored the .git dir. However, I can view them again once I remove the .git dir.

noidilin avatar Oct 16 '25 08:10 noidilin

Looking into this more, it does seem like this is due to the bun 1.3 upgrade

rekram1-node avatar Oct 17 '25 15:10 rekram1-node

Looking into this more, it does seem like this is due to the bun 1.3 upgrade

Is it possible to revert to bun 1.2.* or is the project using any 1.3 APIs?

SunP04 avatar Oct 17 '25 17:10 SunP04

ill have to check and get back to you

rekram1-node avatar Oct 18 '25 22:10 rekram1-node

Maybe not helpful but someone else in the discord is having this issue but exclusively if they run opencode in the vscode terminal, if they run it in basically any other environment it works fine

Has anyone tried other terminals I dont know why that'd work im just relaying what someone said worked for them

rekram1-node avatar Oct 22 '25 22:10 rekram1-node

Has anyone tried other terminals I dont know why that'd work im just relaying what someone said worked for them

I'm facing the same issue, whether I'm running opencode from the VScode terminal (Powershell profile of cmd profile), or directly in a windows terminal. Even with the most basic Win + R and typing opencode pathtomyproject has the same result.

If it can help, here's my output with debug logs:

D:\path\to\project>opencode run ping --print-logs --log-level DEBUG
INFO  2025-10-24T13:29:40 +127ms service=default version=0.15.16 args=["run","ping","--print-logs","--log-level","DEBUG"] opencode
INFO  2025-10-24T13:29:40 +2ms service=project directory=D:\path\to\project fromDirectory
INFO  2025-10-24T13:29:40 +86ms service=config path=C:\Users\Steve\.config\opencode\config.json loading
INFO  2025-10-24T13:29:40 +0ms service=config path=C:\Users\Steve\.config\opencode\opencode.json loading
INFO  2025-10-24T13:29:40 +0ms service=config path=C:\Users\Steve\.config\opencode\opencode.jsonc loading
INFO  2025-10-24T13:29:40 +4ms service=bun cmd=["C:\\Users\\Steve\\AppData\\Roaming\\npm\\node_modules\\opencode-ai\\node_modules\\opencode-windows-x64\\bin\\opencode.exe","add","@opencode-ai/[email protected]","--exact"] cwd=C:\Users\Steve\.config\opencode running
INFO  2025-10-24T13:29:40 +15ms service=bun cmd=["C:\\Users\\Steve\\AppData\\Roaming\\npm\\node_modules\\opencode-ai\\node_modules\\opencode-windows-x64\\bin\\opencode.exe","add","@opencode-ai/[email protected]","--exact"] cwd=D:\path\to\project\.opencode running
INFO  2025-10-24T13:29:40 +7ms service=plugin [email protected] loading plugin
INFO  2025-10-24T13:29:40 +3ms service=plugin [email protected] loading plugin
INFO  2025-10-24T13:29:40 +29ms service=bus type=* subscribing
INFO  2025-10-24T13:29:40 +0ms service=bus type=session.updated subscribing
INFO  2025-10-24T13:29:40 +0ms service=bus type=message.updated subscribing
INFO  2025-10-24T13:29:40 +0ms service=bus type=message.part.updated subscribing
INFO  2025-10-24T13:29:40 +0ms service=format init
INFO  2025-10-24T13:29:40 +0ms service=bus type=file.edited subscribing
INFO  2025-10-24T13:29:40 +3ms service=session id=ses_5e996db98ffelAyiPKsDBsJv6R version=0.15.16 projectID=a0fea2be4f5c2f8bae0ead99325c7240353368b7 directory=D:\path\to\project title=New session - 2025-10-24T13:29:40.711Z time={"created":1761312580711,"updated":1761312580711} created
INFO  2025-10-24T13:29:40 +0ms service=lsp serverIds=deno, typescript, vue, eslint, gopls, ruby-lsp, pyright, elixir-ls, zls, csharp, rust, clangd, svelte, astro, jdtls enabled LSP servers
ERROR 2025-10-24T13:29:40 +1ms service=default e=ENOTCONN: socket is not connected, open rejection
INFO  2025-10-24T13:29:40 +3ms service=bun code=0 stdout=bun add v1.3.0 (b0a6feca)

installed @opencode-ai/[email protected]

[13.00ms] done
 stderr=Saved lockfile
 done
INFO  2025-10-24T13:29:40 +0ms service=bun code=0 stdout=bun add v1.3.0 (b0a6feca)

installed @opencode-ai/[email protected]

[13.00ms] done
 stderr=Saved lockfile
 done
INFO  2025-10-24T13:29:40 +1ms service=bus type=session.updated publishing
INFO  2025-10-24T13:29:40 +2ms service=bus type=message.part.updated subscribing
INFO  2025-10-24T13:29:40 +0ms service=bus type=session.error subscribing
INFO  2025-10-24T13:29:40 +1ms service=session.prompt session=ses_5e996db98ffelAyiPKsDBsJv6R prompt
INFO  2025-10-24T13:29:40 +16ms service=bus type=message.updated publishing
INFO  2025-10-24T13:29:40 +2ms service=bus type=message.part.updated publishing
INFO  2025-10-24T13:29:40 +1ms service=bus type=session.updated publishing
INFO  2025-10-24T13:29:40 +2ms service=models.dev file={} refreshing
INFO  2025-10-24T13:29:40 +3ms service=provider init
INFO  2025-10-24T13:29:40 +2ms service=provider providerID=opencode found
INFO  2025-10-24T13:29:40 +1ms service=provider providerID=github-copilot found
INFO  2025-10-24T13:29:40 +0ms service=provider providerID=github-copilot modelID=claude-haiku-4.5 getModel
INFO  2025-10-24T13:29:40 +0ms service=provider status=started providerID=github-copilot getSDK
INFO  2025-10-24T13:29:40 +76ms service=provider status=completed duration=76 providerID=github-copilot getSDK
INFO  2025-10-24T13:29:40 +2ms service=provider providerID=github-copilot modelID=claude-haiku-4.5 found
INFO  2025-10-24T13:29:40 +0ms service=session.lock sessionID=ses_5e996db98ffelAyiPKsDBsJv6R locked
INFO  2025-10-24T13:29:40 +0ms service=session.prompt session=ses_5e996db98ffelAyiPKsDBsJv6R sessionID=ses_5e996db98ffelAyiPKsDBsJv6R locking
INFO  2025-10-24T13:29:40 +3ms service=session.lock sessionID=ses_5e996db98ffelAyiPKsDBsJv6R unlocked
INFO  2025-10-24T13:29:40 +0ms service=session.prompt session=ses_5e996db98ffelAyiPKsDBsJv6R sessionID=ses_5e996db98ffelAyiPKsDBsJv6R unlocking
ERROR 2025-10-24T13:29:40 +6ms service=default name=Error message=ENOTCONN: socket is not connected, open stack=Error: ENOTCONN: socket is not connected, open
    at spawn (unknown)
    at files (src/file/ripgrep.ts:217:27)
    at processTicksAndRejections (native:7:39) fatal
Error: Unexpected error, check log file at  for more details

ENOTCONN: socket is not connected, open
 syscall: "open",
   errno: -107,
    code: "ENOTCONN"

      at spawn (unknown:1:1)
      at files (src/file/ripgrep.ts:217:27)
      at processTicksAndRejections (native:7:39)

INFO  2025-10-24T13:29:40 +13ms service=bus type=session.idle publishing

The url in the error message that appears only using interactive mode can be opened in the browse without any issue

Image

As other said, running the command in a non git project is OK, but fails in a git project

stevebeauge avatar Oct 24 '25 13:10 stevebeauge

As a workaround I can wrap opencode in a wsl session.

Running wsl opencode run ping --print-logs --log-level DEBUG from my project works quite well. Even ran from my windows project directly (opencode see /mnt/d/path/to/my/project).

stevebeauge avatar Oct 24 '25 13:10 stevebeauge

@stevebeauge thank you this is very helpful, im sorry to everyone that our windows support is so poor right now we really need to step it up in that department :/

rekram1-node avatar Oct 24 '25 15:10 rekram1-node

@stevebeauge thank you this is very helpful, im sorry to everyone that our windows support is so poor right now we really need to step it up in that department :/

Don't worry. Opencode is still a child and will eventually grow up, like many open source software. It's ok to have to wait :)

stevebeauge avatar Oct 24 '25 15:10 stevebeauge