Custom commands fail when (even unused) provider is in config file #1458

Closed
opened 2026-02-16 17:31:04 -05:00 by yindo · 5 comments
Owner

Originally created by @aspiers on GitHub (Aug 23, 2025).

Originally assigned to: @thdxr on GitHub.

Excerpt from end of dev.log:

INFO  2025-08-23T14:39:05 +31308ms service=server method=POST path=/session/ses_728a212f9ffed4Oi2zPmI2f0CK/command request
INFO  2025-08-23T14:39:05 +0ms service=session session=ses_728a212f9ffed4Oi2zPmI2f0CK chatting
INFO  2025-08-23T14:39:05 +10ms service=bus type=storage.write publishing
INFO  2025-08-23T14:39:05 +0ms service=bus type=message.updated publishing
INFO  2025-08-23T14:39:05 +1ms service=bus type=storage.write publishing
INFO  2025-08-23T14:39:05 +0ms service=bus type=message.part.updated publishing
INFO  2025-08-23T14:39:05 +1ms service=bus type=storage.write publishing
INFO  2025-08-23T14:39:05 +0ms service=bus type=session.updated publishing
DEBUG 2025-08-23T14:39:05 +1ms service=tui timeTakenMs=0 messages.renderView
INFO  2025-08-23T14:39:05 +1ms service=session session=ses_728a212f9ffed4Oi2zPmI2f0CK sessionID=ses_728a212f9ffed4Oi2zPmI2f0CK locking
DEBUG 2025-08-23T14:39:05 +0ms service=tui message=msg_8d75e67c3001OuIHYIW5FjvjOA part=prt_8d75e67c3002xIcnrPHylJfLoV message part updated
DEBUG 2025-08-23T14:39:05 +1ms service=tui pending render, skipping
DEBUG 2025-08-23T14:39:05 +0ms service=tui pending render, skipping
DEBUG 2025-08-23T14:39:05 +1ms service=tui timeTakenMs=1 messages.renderView
DEBUG 2025-08-23T14:39:05 +2ms service=tui timeTakenMs=0 messages.renderView
INFO  2025-08-23T14:39:05 +6ms service=bus type=storage.write publishing
INFO  2025-08-23T14:39:05 +1ms service=bus type=message.updated publishing
INFO  2025-08-23T14:39:05 +2ms service=session session=ses_728a212f9ffed4Oi2zPmI2f0CK type=start part
ERROR 2025-08-23T14:39:05 +4ms service=session session=ses_728a212f9ffed4Oi2zPmI2f0CK error={"error":{"code":"ConnectionRefused","path":"http://127.0.0.1:1234/v1/chat/completions","errno":0}} streamText error
INFO  2025-08-23T14:39:05 +0ms service=session session=ses_728a212f9ffed4Oi2zPmI2f0CK type=error part
ERROR 2025-08-23T14:39:05 +0ms service=session session=ses_728a212f9ffed4Oi2zPmI2f0CK error=Unable to connect. Is the computer able to access the url?
INFO  2025-08-23T14:39:05 +0ms service=bus type=session.error publishing
DEBUG 2025-08-23T14:39:05 +1ms service=tui timeTakenMs=3 messages.renderView
INFO  2025-08-23T14:39:05 +0ms service=bus type=storage.write publishing
INFO  2025-08-23T14:39:05 +0ms service=bus type=message.updated publishing
INFO  2025-08-23T14:39:05 +0ms service=session session=ses_728a212f9ffed4Oi2zPmI2f0CK sessionID=ses_728a212f9ffed4Oi2zPmI2f0CK unlocking
INFO  2025-08-23T14:39:05 +0ms service=bus type=session.idle publishing
INFO  2025-08-23T14:39:05 +1ms service=server duration=33 response
ERROR 2025-08-23T14:39:05 +4ms service=tui message=Error: Unable to connect. Is the computer able to access the url? name=UnknownError Server error
DEBUG 2025-08-23T14:39:05 +4ms service=tui timeTakenMs=0 messages.renderView

Originally created by @aspiers on GitHub (Aug 23, 2025). Originally assigned to: @thdxr on GitHub. Excerpt from end of `dev.log`: ``` INFO 2025-08-23T14:39:05 +31308ms service=server method=POST path=/session/ses_728a212f9ffed4Oi2zPmI2f0CK/command request INFO 2025-08-23T14:39:05 +0ms service=session session=ses_728a212f9ffed4Oi2zPmI2f0CK chatting INFO 2025-08-23T14:39:05 +10ms service=bus type=storage.write publishing INFO 2025-08-23T14:39:05 +0ms service=bus type=message.updated publishing INFO 2025-08-23T14:39:05 +1ms service=bus type=storage.write publishing INFO 2025-08-23T14:39:05 +0ms service=bus type=message.part.updated publishing INFO 2025-08-23T14:39:05 +1ms service=bus type=storage.write publishing INFO 2025-08-23T14:39:05 +0ms service=bus type=session.updated publishing DEBUG 2025-08-23T14:39:05 +1ms service=tui timeTakenMs=0 messages.renderView INFO 2025-08-23T14:39:05 +1ms service=session session=ses_728a212f9ffed4Oi2zPmI2f0CK sessionID=ses_728a212f9ffed4Oi2zPmI2f0CK locking DEBUG 2025-08-23T14:39:05 +0ms service=tui message=msg_8d75e67c3001OuIHYIW5FjvjOA part=prt_8d75e67c3002xIcnrPHylJfLoV message part updated DEBUG 2025-08-23T14:39:05 +1ms service=tui pending render, skipping DEBUG 2025-08-23T14:39:05 +0ms service=tui pending render, skipping DEBUG 2025-08-23T14:39:05 +1ms service=tui timeTakenMs=1 messages.renderView DEBUG 2025-08-23T14:39:05 +2ms service=tui timeTakenMs=0 messages.renderView INFO 2025-08-23T14:39:05 +6ms service=bus type=storage.write publishing INFO 2025-08-23T14:39:05 +1ms service=bus type=message.updated publishing INFO 2025-08-23T14:39:05 +2ms service=session session=ses_728a212f9ffed4Oi2zPmI2f0CK type=start part ERROR 2025-08-23T14:39:05 +4ms service=session session=ses_728a212f9ffed4Oi2zPmI2f0CK error={"error":{"code":"ConnectionRefused","path":"http://127.0.0.1:1234/v1/chat/completions","errno":0}} streamText error INFO 2025-08-23T14:39:05 +0ms service=session session=ses_728a212f9ffed4Oi2zPmI2f0CK type=error part ERROR 2025-08-23T14:39:05 +0ms service=session session=ses_728a212f9ffed4Oi2zPmI2f0CK error=Unable to connect. Is the computer able to access the url? INFO 2025-08-23T14:39:05 +0ms service=bus type=session.error publishing DEBUG 2025-08-23T14:39:05 +1ms service=tui timeTakenMs=3 messages.renderView INFO 2025-08-23T14:39:05 +0ms service=bus type=storage.write publishing INFO 2025-08-23T14:39:05 +0ms service=bus type=message.updated publishing INFO 2025-08-23T14:39:05 +0ms service=session session=ses_728a212f9ffed4Oi2zPmI2f0CK sessionID=ses_728a212f9ffed4Oi2zPmI2f0CK unlocking INFO 2025-08-23T14:39:05 +0ms service=bus type=session.idle publishing INFO 2025-08-23T14:39:05 +1ms service=server duration=33 response ERROR 2025-08-23T14:39:05 +4ms service=tui message=Error: Unable to connect. Is the computer able to access the url? name=UnknownError Server error DEBUG 2025-08-23T14:39:05 +4ms service=tui timeTakenMs=0 messages.renderView ```
yindo closed this issue 2026-02-16 17:31:04 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Aug 23, 2025):

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

  • #2200: Similar issue with executing commands using opencode run - although this was about commands not working, it deals with custom command execution failures
  • #2061: Connection/session errors with HTTP 400 - deals with connection issues to endpoints
  • #2169: Agent unable to do anything with together.ai provider - similar connection/execution issues where commands appear to work but fail to connect
  • #2046: Failed to open session errors - related to session connection failures
  • #1908: 500 Internal Server Error with OpenAI compatible APIs - API connection issues

Your specific error shows a ConnectionRefused to localhost:1234, which suggests you may be trying to connect to a local LLM server (like LM Studio, Ollama, etc.) that isn't running or accessible. Please check if your local server is running on that port.

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

@github-actions[bot] commented on GitHub (Aug 23, 2025): This issue might be a duplicate of existing issues. Please check: - #2200: Similar issue with executing commands using opencode run - although this was about commands not working, it deals with custom command execution failures - #2061: Connection/session errors with HTTP 400 - deals with connection issues to endpoints - #2169: Agent unable to do anything with together.ai provider - similar connection/execution issues where commands appear to work but fail to connect - #2046: Failed to open session errors - related to session connection failures - #1908: 500 Internal Server Error with OpenAI compatible APIs - API connection issues Your specific error shows a ConnectionRefused to localhost:1234, which suggests you may be trying to connect to a local LLM server (like LM Studio, Ollama, etc.) that isn't running or accessible. Please check if your local server is running on that port. Feel free to ignore if none of these address your specific case.
Author
Owner

@aspiers commented on GitHub (Aug 23, 2025):

I do have LMStudio configured in my providers section, but this problem manifests even when I'm using Anthropic / sonic / GPT-5, so I don't think the localhost:1234 error is relevant.

@aspiers commented on GitHub (Aug 23, 2025): I do have LMStudio configured in my `providers` section, but this problem manifests even when I'm using Anthropic / `sonic` / GPT-5, so I don't think the localhost:1234 error is relevant.
Author
Owner

@aspiers commented on GitHub (Aug 23, 2025):

Ah! Sorry, looks like it's relevant after all. If I remove the providers section then custom commands start working again. But everything else was working even with the reference to a non-running LMStudio on port 1234, so this is a bug. It should not be necessary to add an LMStudio entry to providers every time you want to use it and remove it every time you shut LMStudio down.

@aspiers commented on GitHub (Aug 23, 2025): Ah! Sorry, looks like it's relevant after all. If I remove the `providers` section then custom commands start working again. But everything else was working even with the reference to a non-running LMStudio on port 1234, so this is a bug. It should not be necessary to add an LMStudio entry to `providers` every time you want to use it and remove it every time you shut LMStudio down.
Author
Owner

@aspiers commented on GitHub (Aug 23, 2025):

Issue title updated. Just to clarify, I had this fragment in opencode.json which comes directly from the docs:

  "provider": {
    "lmstudio": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "LM Studio (local)",
      "options": {
        "baseURL": "http://127.0.0.1:1234/v1"
      },
      "models": {
        "google/gemma-3n-e4b": {
          "name": "Gemma 3n-e4b (local)"
        }
      }
    }
  }

If I start up LM Studio and load the liquid/lfm2-1.2b model, even with opencode configured to use sonic, shockingly it attempts to use that local model (and not even Gemma which is the one in the config file!). So it looks like there is something really weird with how custom commands invoke LLM providers.

@aspiers commented on GitHub (Aug 23, 2025): Issue title updated. Just to clarify, I had this fragment in `opencode.json` which [comes directly from the docs](https://opencode.ai/docs/providers/#lm-studio): ``` "provider": { "lmstudio": { "npm": "@ai-sdk/openai-compatible", "name": "LM Studio (local)", "options": { "baseURL": "http://127.0.0.1:1234/v1" }, "models": { "google/gemma-3n-e4b": { "name": "Gemma 3n-e4b (local)" } } } } ``` If I start up LM Studio and load the `liquid/lfm2-1.2b` model, even with opencode configured to use `sonic`, shockingly it attempts to use that local model (and not even Gemma which is the one in the config file!). So it looks like there is something really weird with how custom commands invoke LLM providers.
Author
Owner

@rekram1-node commented on GitHub (Dec 27, 2025):

[automated] Closing due to 90+ days of inactivity. Feel free to reopen if you still need this!

@rekram1-node commented on GitHub (Dec 27, 2025): [automated] Closing due to 90+ days of inactivity. Feel free to reopen if you still need this!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#1458