Remote Ollama stopped working #1753

Closed
opened 2026-02-16 17:32:29 -05:00 by yindo · 13 comments
Owner

Originally created by @HendrikSP on GitHub (Sep 18, 2025).

Originally assigned to: @thdxr on GitHub.

I had runnig opencode with ollama on a second computer in the local network. It was working fine.

One of the recent updates broke my installation and I'm unable to get it running again. (Since I use opencode only sometimes I cannot pinpoint the exact version that broke for me).

My config to reproduce this:

{
  "$schema": "https://opencode.ai/config.json",
  "disabled_providers": [ "opencode" ],
  "provider": {
    "ollama": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "Ollama",
      "options": {
        "baseURL": "http://192.168.1.26:11434/v1"
      },
      "models": {
        "qwen3:8b": {
          "name": "Qwen3"
        }
      }
    }
  }
}

Then opencode replies to any prompt with "Error: Was there a typo in the url or port?"

Running opencode with log level Debug writes

ERROR 2025-09-18T07:25:08 +2ms service=session.prompt session=ses_6a4498a9dffesactQKgvG248ok error=Was there a typo in the url or port? model=qwen3:8b failed to generate title
ERROR 2025-09-18T07:25:08 +0ms service=session.prompt session=ses_6a4498a9dffesactQKgvG248ok error={"error":{"code":"FailedToOpenSocket","path":"http://192.168.1.26:11434/v1/chat/completions","errno":0}} stream error
INFO  2025-09-18T07:25:08 +1ms service=session.prompt session=ses_6a4498a9dffesactQKgvG248ok type=error part
ERROR 2025-09-18T07:25:08 +0ms service=session.prompt session=ses_6a4498a9dffesactQKgvG248ok error=Was there a typo in the url or port? process

to the log file.

Observations:

  1. I can curl the URL
  2. Other programs on my local computer communicate well with the remote ollama server
  3. Using the hostname of the server results in the same error (I use the IP to report the bug to avoid any influence may caused by DNS issues)
  4. Replacing the IP with localhost or 127.0.0.1 and running ollama locally DOES work!
  5. I disabled the opencode providers to avoid any clutter in the ui or selecting the right model. Removing the line form the config does not solve or change the problem.

opencode v0.9.11

Originally created by @HendrikSP on GitHub (Sep 18, 2025). Originally assigned to: @thdxr on GitHub. I had runnig opencode with ollama on a second computer in the local network. It was working fine. One of the recent updates broke my installation and I'm unable to get it running again. (Since I use opencode only sometimes I cannot pinpoint the exact version that broke for me). My config to reproduce this: ```json { "$schema": "https://opencode.ai/config.json", "disabled_providers": [ "opencode" ], "provider": { "ollama": { "npm": "@ai-sdk/openai-compatible", "name": "Ollama", "options": { "baseURL": "http://192.168.1.26:11434/v1" }, "models": { "qwen3:8b": { "name": "Qwen3" } } } } } ``` Then opencode replies to any prompt with "Error: Was there a typo in the url or port?" Running opencode with log level Debug writes ``` ERROR 2025-09-18T07:25:08 +2ms service=session.prompt session=ses_6a4498a9dffesactQKgvG248ok error=Was there a typo in the url or port? model=qwen3:8b failed to generate title ERROR 2025-09-18T07:25:08 +0ms service=session.prompt session=ses_6a4498a9dffesactQKgvG248ok error={"error":{"code":"FailedToOpenSocket","path":"http://192.168.1.26:11434/v1/chat/completions","errno":0}} stream error INFO 2025-09-18T07:25:08 +1ms service=session.prompt session=ses_6a4498a9dffesactQKgvG248ok type=error part ERROR 2025-09-18T07:25:08 +0ms service=session.prompt session=ses_6a4498a9dffesactQKgvG248ok error=Was there a typo in the url or port? process ``` to the log file. Observations: 1. I can curl the URL 2. Other programs on my local computer communicate well with the remote ollama server 3. Using the hostname of the server results in the same error (I use the IP to report the bug to avoid any influence may caused by DNS issues) 4. Replacing the IP with `localhost` or `127.0.0.1` and running ollama locally DOES work! 5. I disabled the opencode providers to avoid any clutter in the ui or selecting the right model. Removing the line form the config does not solve or change the problem. opencode v0.9.11
yindo closed this issue 2026-02-16 17:32:29 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Sep 18, 2025):

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

  • #227: Ollama does not work as a provider unless configured with an API key - This issue describes similar connectivity problems with remote Ollama servers and mentions configuration requirements
  • #116: Provider ollama AI_APICallError - Shows similar JSON unmarshaling errors when connecting to Ollama providers

The FailedToOpenSocket error you're experiencing when connecting to remote Ollama (but not localhost) appears to be related to how opencode handles remote Ollama connections, which has been reported before.

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

@github-actions[bot] commented on GitHub (Sep 18, 2025): This issue might be a duplicate of existing issues. Please check: - #227: Ollama does not work as a provider unless configured with an API key - This issue describes similar connectivity problems with remote Ollama servers and mentions configuration requirements - #116: Provider ollama AI_APICallError - Shows similar JSON unmarshaling errors when connecting to Ollama providers The FailedToOpenSocket error you're experiencing when connecting to remote Ollama (but not localhost) appears to be related to how opencode handles remote Ollama connections, which has been reported before. Feel free to ignore if none of these address your specific case.
Author
Owner

@HendrikSP commented on GitHub (Sep 18, 2025):

EDIT: I clear also ~/.cache/opencode

@HendrikSP commented on GitHub (Sep 18, 2025): EDIT: I clear also `~/.cache/opencode`
Author
Owner

@HendrikSP commented on GitHub (Sep 18, 2025):

EDIT: I added an API key, same result.

@HendrikSP commented on GitHub (Sep 18, 2025): EDIT: I added an API key, same result.
Author
Owner

@Dark-Kernel commented on GitHub (Sep 18, 2025):

It's working on my machine though

Image

i'm using qwen2.5:0.5b for testing purpose and it works.
Please check if you ollama server is listening on all interface,

Try running:
❯ curl http://192.168.1.26:11434/api/generate -d '{ "model": "qwen3:8b", "prompt": "What is water made of?" }'

if it doesn't work, then set this environment variable

OLLAMA_HOST=0.0.0.0:11434

@Dark-Kernel commented on GitHub (Sep 18, 2025): It's working on my machine though <img width="1366" height="768" alt="Image" src="https://github.com/user-attachments/assets/da69111d-dc09-47eb-a2db-7f869f2953e7" /> i'm using `qwen2.5:0.5b` for testing purpose and it works. Please check if you ollama server is listening on all interface, Try running: ❯ curl http://192.168.1.26:11434/api/generate -d '{ "model": "qwen3:8b", "prompt": "What is water made of?" }' if it doesn't work, then set this environment variable `OLLAMA_HOST=0.0.0.0:11434`
Author
Owner

@rekram1-node commented on GitHub (Sep 18, 2025):

This seems like something specific to your setup rather than an opencode issue

@rekram1-node commented on GitHub (Sep 18, 2025): This seems like something specific to your setup rather than an opencode issue
Author
Owner

@HendrikSP commented on GitHub (Sep 18, 2025):

Thank a lot for trying to reproduce it!

However as stated initially I indeed can curl the remote Ollama and other AI applications work well:

curl http://192.168.1.26:11434/api/generate -d '{ "model": "qwen3:8b", "prompt": "What is water made of?" }'
{"model":"qwen3:8b","created_at":"2025-09-18T15:53:07.271567Z","response":"\u003cthink\u003e","done":false}
{"model":"qwen3:8b","created_at":"2025-09-18T15:53:07.285369Z","response":"\n","done":false}
{"model":"qwen3:8b","created_at":"2025-09-18T15:53:07.298985Z","response":"Okay","done":false}
{"model":"qwen3:8b","created_at":"2025-09-18T15:53:07.312553Z","response":",","done":false}
{"model":"qwen3:8b","created_at":"2025-09-18T15:53:07.326395Z","response":" the","done":false}
{"model":"qwen3:8b","created_at":"2025-09-18T15:53:07.340083Z","response":" user","done":false}
{"model":"qwen3:8b","created_at":"2025-09-18T15:53:07.353762Z","response":" is","done":false}
{"model":"qwen3:8b","created_at":"2025-09-18T15:53:07.367425Z","response":" asking","done":false}
{"model":"qwen3:8b","created_at":"2025-09-18T15:53:07.381219Z","response":" \"","done":false}
{"model":"qwen3:8b","created_at":"2025-09-18T15:53:07.394836Z","response":"What","done":false}
...

So its here only my opencode setup that is broken, but the debug log does any good hints. How can I debug this further?

@HendrikSP commented on GitHub (Sep 18, 2025): Thank a lot for trying to reproduce it! However as stated initially I indeed can curl the remote Ollama and other AI applications work well: ```sh curl http://192.168.1.26:11434/api/generate -d '{ "model": "qwen3:8b", "prompt": "What is water made of?" }' {"model":"qwen3:8b","created_at":"2025-09-18T15:53:07.271567Z","response":"\u003cthink\u003e","done":false} {"model":"qwen3:8b","created_at":"2025-09-18T15:53:07.285369Z","response":"\n","done":false} {"model":"qwen3:8b","created_at":"2025-09-18T15:53:07.298985Z","response":"Okay","done":false} {"model":"qwen3:8b","created_at":"2025-09-18T15:53:07.312553Z","response":",","done":false} {"model":"qwen3:8b","created_at":"2025-09-18T15:53:07.326395Z","response":" the","done":false} {"model":"qwen3:8b","created_at":"2025-09-18T15:53:07.340083Z","response":" user","done":false} {"model":"qwen3:8b","created_at":"2025-09-18T15:53:07.353762Z","response":" is","done":false} {"model":"qwen3:8b","created_at":"2025-09-18T15:53:07.367425Z","response":" asking","done":false} {"model":"qwen3:8b","created_at":"2025-09-18T15:53:07.381219Z","response":" \"","done":false} {"model":"qwen3:8b","created_at":"2025-09-18T15:53:07.394836Z","response":"What","done":false} ... ``` So its here only my opencode setup that is broken, but the debug log does any good hints. How can I debug this further?
Author
Owner

@rekram1-node commented on GitHub (Sep 18, 2025):

@HendrikSP can you curl the completions endpoint tho? /v1/chat/completions

@rekram1-node commented on GitHub (Sep 18, 2025): @HendrikSP can you curl the completions endpoint tho? ` /v1/chat/completions `
Author
Owner

@HendrikSP commented on GitHub (Sep 18, 2025):

Yes, i can:

curl http://192.168.1.26:11434/v1/chat/completions -d '{ "model": "qwen3:8b", "messages": [ { "role": "user", "content": "What is water made of?" } ] }'

{"id":"chatcmpl-681","object":"chat.completion","created":1758214346,"model":"qwen3:8b","system_fingerprint":"fp_ollama","choices":[{"index":0,"message":{"role":"assistant","content":"\u003cthink\u003e\nOkay, the user is asking, \"What is water m...
@HendrikSP commented on GitHub (Sep 18, 2025): Yes, i can: ```sh curl http://192.168.1.26:11434/v1/chat/completions -d '{ "model": "qwen3:8b", "messages": [ { "role": "user", "content": "What is water made of?" } ] }' {"id":"chatcmpl-681","object":"chat.completion","created":1758214346,"model":"qwen3:8b","system_fingerprint":"fp_ollama","choices":[{"index":0,"message":{"role":"assistant","content":"\u003cthink\u003e\nOkay, the user is asking, \"What is water m... ```
Author
Owner

@HendrikSP commented on GitHub (Sep 18, 2025):

Hi, thank you for your help here. I went down the rabbit hole and tried a an simple example using ai-sdk directly. Not working. Tried to use just fetch. Not working. Found out that bun and node are affected. Tried a different Terminal App - works. It seems that Apple is blocking my other Terminal, but the only affected programs seems to be node and bun as far as I can tell. The Terminal App have permissions to access the local net. I will look into that myself now. Thanks again! :)

@HendrikSP commented on GitHub (Sep 18, 2025): Hi, thank you for your help here. I went down the rabbit hole and tried a an simple example using ai-sdk directly. Not working. Tried to use just fetch. Not working. Found out that bun and node are affected. Tried a different Terminal App - works. It seems that Apple is blocking my other Terminal, but the only affected programs seems to be node and bun as far as I can tell. The Terminal App have permissions to access the local net. I will look into that myself now. Thanks again! :)
Author
Owner

@Dark-Kernel commented on GitHub (Sep 18, 2025):

Damn.

@Dark-Kernel commented on GitHub (Sep 18, 2025): Damn.
Author
Owner

@HendrikSP commented on GitHub (Sep 18, 2025):

PS: Working now everywhere. Seems an Update of the Terminal app and a long running tmux session was the problem. Why only the JS engines had been effected is not clear nor logical to me. :)

@HendrikSP commented on GitHub (Sep 18, 2025): PS: Working now everywhere. Seems an Update of the Terminal app and a long running tmux session was the problem. Why only the JS engines had been effected is not clear nor logical to me. :)
Author
Owner

@pieterst67 commented on GitHub (Oct 1, 2025):

PS: Working now everywhere. Seems an Update of the Terminal app and a long running tmux session was the problem. Why only the JS engines had been effected is not clear nor logical to me. :)

I have the same problem, tmux getting blocked after a while and opencode gives an error when trying to connect to the llm server. Tmux kill-server solves the blocking, but this is not ideal...

@pieterst67 commented on GitHub (Oct 1, 2025): > PS: Working now everywhere. Seems an Update of the Terminal app and a long running tmux session was the problem. Why only the JS engines had been effected is not clear nor logical to me. :) I have the same problem, tmux getting blocked after a while and opencode gives an error when trying to connect to the llm server. Tmux kill-server solves the blocking, but this is not ideal...
Author
Owner

@preflightsiren commented on GitHub (Feb 4, 2026):

just wanted to comment that I've been trying to debug the same behaviour; I normally use long running tmux sessions for everything and couldn't understand why I got the Error: Was there a typo in the url or port? error.

Starting a terminal without tmux (raw bash or zsh for example), lets you run opencode connecting to remote ollama just fine.

very weird behaviour 🤷

@preflightsiren commented on GitHub (Feb 4, 2026): just wanted to comment that I've been trying to debug the same behaviour; I normally use long running tmux sessions for everything and couldn't understand why I got the `Error: Was there a typo in the url or port?` error. Starting a terminal without tmux (raw bash or zsh for example), lets you run opencode connecting to remote ollama just fine. very weird behaviour 🤷
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#1753