You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Certain tool calling frequently fails and disconnects the chat #2519
Interestingly, it appears to have started working again once I deleted the .idea directory that GoLand had generated.
My bad, I'd switched to Plan mode, which worked fine. Back to agent mode, same issue.
EDIT: The current task was trying to create an i18n file for the Lao language. I skipped that task, and the agent was able to continue. Any chance foreign characters were making the tools break?
While I understand the technical reason for your point, the developer in me knows these things can often not be what they seem. What I know is when I made the agent skip whatever tooling it was trying to run and move to a different task, it immediately started working fine. That could still be the API/Provider being the issue, but could also be an internal issue triggering what looks like a timeout or connection drop. The agent came back to the whole Lao language thing and completed it eventually, just not when it originally tried to do it.
At the very least, it'd be useful to see the tool/request/details. Maybe a new /why command that tells you about the last request, it's input, output, etc. Or a /retry-verbose that re-runs the previous request but the results are verbose displayed.
EDIT: I can confirm this is likely my provider. I managed to replicate the issue in a different IDE. However, I'd still like to have the ability to quickly enter a request into opencode CLI to see detailed info about the exact request that was dropped and stats around it.
Version 1.0.85 on macOS I'm seeing the same error happening but my provider is a lemonade server on my local LAN. still possible but lower likelihood that the local machine is dropping the connection. No other agents or web chats or other means of accessing the local provider are reporting any socket errors. Just opencode.
here's a fresh /init in a new session in a test project:
Since upgrading to 1.0.85 it looks to me like every tool call results in the same socket connection closed error. I know that i upgraded from 1.0.65 to 1.0.85, but unfortunately I cannot recall whether I was getting successful tool calls with 1.0.65 or if the last time I successfully used opencode was with an even earlier version than that. You guys are plowing through the version numbers pretty fast 😄 .
All I see in the log associated with the above is this:
INFO 2025-11-21T13:28:37 +295997ms service=bus type=* unsubscribing
INFO 2025-11-21T13:28:37 +0ms service=server event disconnected
Is there somewhere I can dig to try to debug this?
@rekram1-node I've updated to opencode 1.0.98 and still seeing the same tool-calling socket error. Here is the result of your print-logs suggestion. I'm not seeing anything in here that seems helpful to my eyes. You?
➜ opencode run "list the files in the working directory" --print-logs
INFO 2025-11-22T10:26:52 +758ms service=default version=1.0.98 args=["run","list the files in the working directory","--print-logs"] opencode
INFO 2025-11-22T10:26:52 +1ms service=default directory=/Users/pjv/development/projects/test python project creating instance
INFO 2025-11-22T10:26:52 +1ms service=project directory=/Users/pjv/development/projects/test python project fromDirectory
INFO 2025-11-22T10:26:52 +11ms service=default directory=/Users/pjv/development/projects/test python project bootstrapping
INFO 2025-11-22T10:26:52 +3ms service=config path=/Users/pjv/.config/opencode/config.json loading
INFO 2025-11-22T10:26:52 +0ms service=config path=/Users/pjv/.config/opencode/opencode.json loading
INFO 2025-11-22T10:26:52 +8ms service=config path=/Users/pjv/.config/opencode/opencode.jsonc loading
INFO 2025-11-22T10:26:52 +3ms service=bun cmd=["/usr/local/Cellar/opencode/1.0.98/libexec/lib/node_modules/opencode-ai/node_modules/opencode-darwin-x64/bin/opencode","add","@opencode-ai/plugin@1.0.98","--exact"] cwd=/Users/pjv/.config/opencode running
INFO 2025-11-22T10:26:52 +25ms service=bun code=0 stdout=bun add v1.3.3 (274e01c7)
installed @opencode-ai/plugin@1.0.98
[4.00ms] done
stderr=Saved lockfile
done
INFO 2025-11-22T10:26:52 +3ms service=plugin path=opencode-copilot-auth@0.0.5 loading plugin
INFO 2025-11-22T10:26:52 +2ms service=plugin path=opencode-anthropic-auth@0.0.2 loading plugin
INFO 2025-11-22T10:26:52 +34ms service=bus type=* subscribing
INFO 2025-11-22T10:26:52 +0ms service=bus type=session.updated subscribing
INFO 2025-11-22T10:26:52 +1ms service=bus type=message.updated subscribing
INFO 2025-11-22T10:26:52 +0ms service=bus type=message.part.updated subscribing
INFO 2025-11-22T10:26:52 +0ms service=format init
INFO 2025-11-22T10:26:52 +0ms service=bus type=file.edited subscribing
INFO 2025-11-22T10:26:52 +0ms service=lsp serverIds=deno, typescript, vue, eslint, gopls, ruby-lsp, pyright, elixir-ls, zls, csharp, sourcekit-lsp, rust, clangd, svelte, astro, jdtls, yaml-ls, lua-ls, php intelephense enabled LSP servers
INFO 2025-11-22T10:26:52 +2ms service=bus type=command.executed subscribing
INFO 2025-11-22T10:26:52 +34ms service=server method=POST path=/session request
INFO 2025-11-22T10:26:52 +0ms service=server status=started method=POST path=/session request
INFO 2025-11-22T10:26:52 +2ms service=session id=ses_554e5ccb7ffe5WnxS8w1Z6L2hQ version=1.0.98 projectID=global directory=/Users/pjv/development/projects/test python project title=New session - 2025-11-22T10:26:52.360Z time={"created":1763807212360,"updated":1763807212360} created
INFO 2025-11-22T10:26:52 +1ms service=bus type=session.created publishing
INFO 2025-11-22T10:26:52 +0ms service=bus type=session.updated publishing
INFO 2025-11-22T10:26:52 +1ms service=server status=completed duration=4 method=POST path=/session request
INFO 2025-11-22T10:26:52 +4ms service=server method=GET path=/config request
INFO 2025-11-22T10:26:52 +0ms service=server status=started method=GET path=/config request
INFO 2025-11-22T10:26:52 +0ms service=server status=completed duration=0 method=GET path=/config request
INFO 2025-11-22T10:26:52 +3ms service=server method=GET path=/event request
INFO 2025-11-22T10:26:52 +0ms service=server status=started method=GET path=/event request
INFO 2025-11-22T10:26:52 +0ms service=server event connected
INFO 2025-11-22T10:26:52 +2ms service=bus type=* subscribing
INFO 2025-11-22T10:26:52 +1ms service=server status=completed duration=3 method=GET path=/event request
INFO 2025-11-22T10:26:52 +1ms service=server method=POST path=/session/ses_554e5ccb7ffe5WnxS8w1Z6L2hQ/message request
INFO 2025-11-22T10:26:52 +0ms service=server status=started method=POST path=/session/ses_554e5ccb7ffe5WnxS8w1Z6L2hQ/message request
INFO 2025-11-22T10:26:52 +3ms service=server status=completed duration=3 method=POST path=/session/ses_554e5ccb7ffe5WnxS8w1Z6L2hQ/message request
INFO 2025-11-22T10:26:52 +9ms service=bus type=message.updated publishing
INFO 2025-11-22T10:26:52 +2ms service=bus type=message.part.updated publishing
INFO 2025-11-22T10:26:52 +1ms service=bus type=session.updated publishing
INFO 2025-11-22T10:26:52 +1ms service=bus type=session.status publishing
INFO 2025-11-22T10:26:52 +1ms service=session.prompt step=0 sessionID=ses_554e5ccb7ffe5WnxS8w1Z6L2hQ loop
INFO 2025-11-22T10:26:52 +4ms service=provider status=started state
INFO 2025-11-22T10:26:52 +1ms service=models.dev file={} refreshing
INFO 2025-11-22T10:26:52 +4ms service=provider init
INFO 2025-11-22T10:26:52 +5ms service=provider providerID=lemonade npm=@ai-sdk/openai-compatible found
INFO 2025-11-22T10:26:52 +0ms service=provider providerID=opencode npm=@ai-sdk/openai-compatible found
INFO 2025-11-22T10:26:52 +0ms service=provider status=completed duration=10 state
INFO 2025-11-22T10:26:52 +0ms service=provider providerID=lemonade modelID=Qwen3-Coder-30B-A3B-Instruct-GGUF getModel
INFO 2025-11-22T10:26:52 +1ms service=provider status=started providerID=lemonade getSDK
INFO 2025-11-22T10:26:52 +0ms service=provider providerID=lemonade modelID=Qwen3-4B-Instruct-2507-GGUF getModel
INFO 2025-11-22T10:26:52 +0ms service=provider status=started providerID=lemonade getSDK
INFO 2025-11-22T10:26:52 +76ms service=provider status=completed duration=76 providerID=lemonade getSDK
INFO 2025-11-22T10:26:52 +2ms service=provider providerID=lemonade modelID=Qwen3-Coder-30B-A3B-Instruct-GGUF found
INFO 2025-11-22T10:26:52 +2ms service=bus type=message.updated publishing
INFO 2025-11-22T10:26:52 +2ms service=provider status=completed duration=82 providerID=lemonade getSDK
INFO 2025-11-22T10:26:52 +1ms service=provider providerID=lemonade modelID=Qwen3-4B-Instruct-2507-GGUF found
INFO 2025-11-22T10:26:52 +16ms service=bash-tool shell=/usr/local/bin/fish bash tool using shell
INFO 2025-11-22T10:26:52 +8ms service=session.processor process
INFO 2025-11-22T10:26:52 +5ms service=bus type=session.status publishing
INFO 2025-11-22T10:26:52 +7ms service=bus type=message.updated publishing
INFO 2025-11-22T10:26:52 +1ms service=bus type=session.updated publishing
INFO 2025-11-22T10:26:52 +1ms service=bus type=session.diff publishing
ERROR 2025-11-22T10:26:53 +960ms service=session.prompt error=Invalid JSON response Caused by: Type validation failed: Value: {"error":{"message":"Network error: CURL error: Server returned nothing (no headers, no data)","type":"network_error"}}.
Error message: [{"expected":"array","code":"invalid_type","path":["choices"],"message":"Invalid input: expected array, received undefined"}] model=Qwen3-4B-Instruct-2507-GGUF failed to generate title
ERROR 2025-11-22T10:26:53 +0ms service=acp-command promise={} reason=Invalid JSON response Caused by: Type validation failed: Value: {"error":{"message":"Network error: CURL error: Server returned nothing (no headers, no data)","type":"network_error"}}.
Error message: [{"expected":"array","code":"invalid_type","path":["choices"],"message":"Invalid input: expected array, received undefined"}] Unhandled rejection
ERROR 2025-11-22T10:26:53 +1ms service=default e=Invalid JSON response rejection
INFO 2025-11-22T10:27:20 +27511ms service=bus type=message.part.updated publishing
INFO 2025-11-22T10:27:21 +63ms service=bus type=message.part.updated publishing
INFO 2025-11-22T10:27:21 +76ms service=bus type=message.part.updated publishing
INFO 2025-11-22T10:27:21 +449ms service=bus type=message.part.updated publishing
INFO 2025-11-22T10:27:21 +29ms service=bus type=message.part.updated publishing
| List Users/pjv/development/projects/test python project
INFO 2025-11-22T10:27:21 +138ms service=bus type=message.part.updated publishing
INFO 2025-11-22T10:27:21 +3ms service=bus type=message.part.updated publishing
INFO 2025-11-22T10:27:21 +1ms service=bus type=message.updated publishing
<function=list
INFO 2025-11-22T10:27:21 +2ms service=bus type=message.updated publishing
INFO 2025-11-22T10:27:21 +0ms service=bus type=session.status publishing
INFO 2025-11-22T10:27:21 +0ms service=session.prompt step=1 sessionID=ses_554e5ccb7ffe5WnxS8w1Z6L2hQ loop
INFO 2025-11-22T10:27:21 +2ms service=bus type=message.updated publishing
INFO 2025-11-22T10:27:21 +0ms service=bus type=message.updated publishing
INFO 2025-11-22T10:27:21 +1ms service=bus type=session.updated publishing
INFO 2025-11-22T10:27:21 +1ms service=bus type=session.diff publishing
INFO 2025-11-22T10:27:21 +1ms service=bash-tool shell=/usr/local/bin/fish bash tool using shell
INFO 2025-11-22T10:27:21 +2ms service=session.processor process
INFO 2025-11-22T10:27:21 +4ms service=bus type=session.status publishing
ERROR 2025-11-22T10:27:21 +49ms service=session.prompt error={"error":{"code":"ECONNRESET","path":"http://ai.msky:8000/api/v1/chat/completions","errno":0}} stream error
ERROR 2025-11-22T10:27:21 +1ms service=session.processor error=The socket connection was closed unexpectedly. For more information, pass `verbose: true` in the second argument to fetch() process
INFO 2025-11-22T10:27:21 +1ms service=bus type=session.error publishing
Error: Error: The socket connection was closed unexpectedly. For more information, pass `verbose: true` in the second argument to fetch()
INFO 2025-11-22T10:27:21 +2ms service=bus type=message.updated publishing
INFO 2025-11-22T10:27:21 +0ms service=session.compaction pruning
INFO 2025-11-22T10:27:21 +1ms service=session.prompt sessionID=ses_554e5ccb7ffe5WnxS8w1Z6L2hQ cancel
INFO 2025-11-22T10:27:21 +0ms service=bus type=session.status publishing
INFO 2025-11-22T10:27:21 +0ms service=bus type=session.idle publishing
@rekram1-node I get that that's what the error means. What I don't get is why the provider only cuts off opencode. I use the same provider with other agents and front ends that also use tool-calling like goose, zed, openwebui, and none of them throw any such error or get interrupted. only opencode.
Activity
github-actions commentedon Sep 9, 2025
This issue might be a duplicate of existing issues. Please check:
verbose: truein the second argument to fetch() #1692: Identical socket connection error messageFeel free to ignore if none of these address your specific case.
rekram1-node commentedon Sep 9, 2025
thx for raising
Durandle46 commentedon Oct 12, 2025
+1 on this issue.
Interestingly, it appears to have started working again once I deleted the.ideadirectory that GoLand had generated.My bad, I'd switched to Plan mode, which worked fine. Back to agent mode, same issue.
EDIT: The current task was trying to create an i18n file for the Lao language. I skipped that task, and the agent was able to continue. Any chance foreign characters were making the tools break?
rekram1-node commentedon Oct 12, 2025
if it is the socket error that is probably your provider dropping your connection unexpectedly that shouldnt have anytning to do with tools
at least nothing comes to mind ad to why thatd be
Durandle46 commentedon Oct 12, 2025
While I understand the technical reason for your point, the developer in me knows these things can often not be what they seem. What I know is when I made the agent skip whatever tooling it was trying to run and move to a different task, it immediately started working fine. That could still be the API/Provider being the issue, but could also be an internal issue triggering what looks like a timeout or connection drop. The agent came back to the whole Lao language thing and completed it eventually, just not when it originally tried to do it.
rekram1-node commentedon Oct 12, 2025
yeah i see, was this a toasted error for you or did you see it in the actual message history too
Durandle46 commentedon Oct 13, 2025
@rekram1-node
Toast and History
At the very least, it'd be useful to see the tool/request/details. Maybe a new
/whycommand that tells you about the last request, it's input, output, etc. Or a/retry-verbosethat re-runs the previous request but the results are verbose displayed.EDIT: I can confirm this is likely my provider. I managed to replicate the issue in a different IDE. However, I'd still like to have the ability to quickly enter a request into opencode CLI to see detailed info about the exact request that was dropped and stats around it.
rekram1-node commentedon Oct 13, 2025
thx for sharing
pjv commentedon Nov 21, 2025
Version 1.0.85 on macOS I'm seeing the same error happening but my provider is a lemonade server on my local LAN. still possible but lower likelihood that the local machine is dropping the connection. No other agents or web chats or other means of accessing the local provider are reporting any socket errors. Just opencode.
here's a fresh
/initin a new session in a test project:Since upgrading to 1.0.85 it looks to me like every tool call results in the same socket connection closed error. I know that i upgraded from 1.0.65 to 1.0.85, but unfortunately I cannot recall whether I was getting successful tool calls with 1.0.65 or if the last time I successfully used opencode was with an even earlier version than that. You guys are plowing through the version numbers pretty fast 😄 .
All I see in the log associated with the above is this:
Is there somewhere I can dig to try to debug this?
rekram1-node commentedon Nov 21, 2025
Maybe try
opencode run <prompt> --print-logsand try to get outputs?can also try running opencode yourself we should add some way to get fetch call logs or something
pjv commentedon Nov 22, 2025
@rekram1-node I've updated to opencode 1.0.98 and still seeing the same tool-calling socket error. Here is the result of your print-logs suggestion. I'm not seeing anything in here that seems helpful to my eyes. You?
rekram1-node commentedon Nov 23, 2025
alr ill look into it
rekram1-node commentedon Nov 24, 2025
@pjv that error is coming from your provider,
ECONNRESETmeans the server cutoff opencodes connectionpjv commentedon Nov 24, 2025
@rekram1-node I get that that's what the error means. What I don't get is why the provider only cuts off opencode. I use the same provider with other agents and front ends that also use tool-calling like goose, zed, openwebui, and none of them throw any such error or get interrupted. only opencode.
rekram1-node commentedon Nov 24, 2025
Can you share your opencode.json? Looks like a custom provider right
pjv commentedon Nov 24, 2025
Yes, it's a local lemonade server running on a different host on my LAN: