Repository navigation
Closed
Description
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:
- I can curl the URL
- Other programs on my local computer communicate well with the remote ollama server
- 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)
- Replacing the IP with
localhostor127.0.0.1and running ollama locally DOES work! - 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
Reacted by Pablo Ramirez and twistdroach
Metadata
Metadata
Assignees
Labels
No labels
Activity
github-actions commentedon Sep 18, 2025
This issue might be a duplicate of existing issues. Please check:
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.
HendrikSP commentedon Sep 18, 2025
EDIT: I clear also
~/.cache/opencodeHendrikSP commentedon Sep 18, 2025
EDIT: I added an API key, same result.
Dark-Kernel commentedon Sep 18, 2025
It's working on my machine though
i'm using
qwen2.5:0.5bfor 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:11434rekram1-node commentedon Sep 18, 2025
This seems like something specific to your setup rather than an opencode issue
HendrikSP commentedon 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:
So its here only my opencode setup that is broken, but the debug log does any good hints. How can I debug this further?
rekram1-node commentedon Sep 18, 2025
@HendrikSP can you curl the completions endpoint tho?
/v1/chat/completionsHendrikSP commentedon Sep 18, 2025
Yes, i can:
HendrikSP commentedon 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! :)
Dark-Kernel commentedon Sep 18, 2025
Damn.
HendrikSP commentedon 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. :)
pieterst67 commentedon Oct 1, 2025
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...
preflightsiren commentedon 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 🤷
rfrowe commentedon Feb 28, 2026
I ran into this. I did not have tmux running on either host or client machine. The only way I could get it to work was by SSH tunnel then changing the baseURL to 127.0.0.1
idcrook commentedon Mar 2, 2026
I could not get to work. trying from macos (opencode) to windows (llama.cpp lllama-server /v1 openai). using the LAN IP address always is saying
Error: Was there a typo in the url or port?my workstation is macos, and the GTX card is installed in a windows machine, so I am not willing to run opencode on windows.
YukiGibson commentedon Mar 3, 2026
Be careful if you use iTerm2, I switched to another terminal, in this case Ghostty and the local IP worked. Beforehand I had to SSH port forwarding. So yes check your local environment first, no idea why some terminals just block access to local IP's for now reason at all.
idcrook commentedon Mar 3, 2026
thanks for the tip. by the way, I tried enabling debug logging verbosity and I couldn't find any difference in the log file. the most frustrating thing on this is lack of visibility into the error/conditions.
idcrook commentedon Mar 3, 2026
I installed
Ghosttyon my macos, ranopencode uninstalland thenbrew install opencode, saving my oldconfig.jsoninto config directory and starting opencode in aghosttysession.There were macOS network access dialog and Little Snitch (firewall) warnings I had to allow. Got
Error: Was there a typo in the url or portthe first time I tried/init.but then after approving the access to LAN for firewalls,
opencodestarted working with my llama.cpp llama-server qwen3-coder-next model running on another host in my LAN.it's possible that my
iTerm2.appdidn't have the right firewall allowances which led to the earlier errors.