Serve on custom port / remote server broken #3801

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

Originally created by @gempir on GitHub (Dec 23, 2025).

Originally assigned to: @thdxr on GitHub.

Description

I've tried this on 3 different computers now. The frontend doesn't work for me anymore. I don't understand how this broke, because I used to have it working. But even reverting to older versions doesn't work.

The frontend seems to be "hardcoded" to send requests to
http://localhost:4096/global/health
http://localhost:4096/global/event

Which fail when the serve is either remote or a custom port is used.

OpenCode version

1.0.193

Steps to reproduce

  1. opencode serve -p 8075
  2. open http://127.0.0.1:8075

Screenshot and/or share link

Image

Operating System

macOS 26.2

Terminal

Alacritty

Originally created by @gempir on GitHub (Dec 23, 2025). Originally assigned to: @thdxr on GitHub. ### Description I've tried this on 3 different computers now. The frontend doesn't work for me anymore. I don't understand how this broke, because I used to have it working. But even reverting to older versions doesn't work. The frontend seems to be "hardcoded" to send requests to `http://localhost:4096/global/health` `http://localhost:4096/global/event` Which fail when the serve is either remote or a custom port is used. ### OpenCode version 1.0.193 ### Steps to reproduce 1. opencode serve -p 8075 2. open http://127.0.0.1:8075 ### Screenshot and/or share link <img width="790" height="308" alt="Image" src="https://github.com/user-attachments/assets/46bda973-0d19-410b-9658-3a9c4fc88821" /> ### Operating System macOS 26.2 ### Terminal Alacritty
yindo added the bug label 2026-02-16 17:41:31 -05:00
yindo closed this issue 2026-02-16 17:41:31 -05:00
Author
Owner

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

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

  • #5928: opencode --port=8080 fails because port statically bound to 4096 (similar issue with hardcoded port 4096 in frontend)
  • #5844: Bug: Web terminal fails when accessing via network IP instead of localhost (related issue with frontend URL construction)

Both issues describe the same root cause where the frontend hardcodes requests to localhost:4096 instead of using the actual server address. Feel free to ignore if your specific case differs.

@github-actions[bot] commented on GitHub (Dec 23, 2025): This issue might be a duplicate of existing issues. Please check: - #5928: opencode --port=8080 fails because port statically bound to 4096 (similar issue with hardcoded port 4096 in frontend) - #5844: Bug: Web terminal fails when accessing via network IP instead of localhost (related issue with frontend URL construction) Both issues describe the same root cause where the frontend hardcodes requests to localhost:4096 instead of using the actual server address. Feel free to ignore if your specific case differs.
Author
Owner

@gempir commented on GitHub (Dec 23, 2025):

My bad this seems to be #5928

@gempir commented on GitHub (Dec 23, 2025): My bad this seems to be #5928
Author
Owner

@gempir commented on GitHub (Dec 23, 2025):

I'll reopen this because this issue isn't fixed on the latest version 1.0.196 and the other issue is closed.
I think the fix PR got reverted

@gempir commented on GitHub (Dec 23, 2025): I'll reopen this because this issue isn't fixed on the latest version 1.0.196 and the other issue is closed. I think the fix PR got reverted
Author
Owner

@gempir commented on GitHub (Dec 27, 2025):

Still broken on, even after https://github.com/sst/opencode/pull/6181

easy reproducer on current version:

bunx opencode-ai@1.0.204 serve --port 3123

@gempir commented on GitHub (Dec 27, 2025): Still broken on, even after https://github.com/sst/opencode/pull/6181 easy reproducer on current version: bunx opencode-ai@1.0.204 serve --port 3123
Author
Owner

@mosajjal commented on GitHub (Dec 27, 2025):

can confirm this is broken for me too

@mosajjal commented on GitHub (Dec 27, 2025): can confirm this is broken for me too
Author
Owner

@Kiricon commented on GitHub (Dec 27, 2025):

Still broken for me as well.

@Kiricon commented on GitHub (Dec 27, 2025): Still broken for me as well.
Author
Owner

@gempir commented on GitHub (Dec 29, 2025):

I cannot reproduce it anymore. It works for me now. Even on bunx opencode-ai@1.0.204 serve --port 3123 this.

I don't really get how the behaviour is changing without the version changing. Is there some part of the code that's not part of the versioned npm package?

@gempir commented on GitHub (Dec 29, 2025): I cannot reproduce it anymore. It works for me now. Even on `bunx opencode-ai@1.0.204 serve --port 3123` this. I don't really get how the behaviour is changing without the version changing. Is there some part of the code that's not part of the versioned npm package?
Author
Owner

@mosajjal commented on GitHub (Dec 29, 2025):

in 1.0.209 it seems to be fixed?

@mosajjal commented on GitHub (Dec 29, 2025): in 1.0.209 it seems to be fixed?
Author
Owner

@gempir commented on GitHub (Dec 30, 2025):

It works just fine in 1.0.204 too, I think this isn't version related. There has to be some external factor.

6352 Talks about some proxy, maybe it's related, not sure.

@gempir commented on GitHub (Dec 30, 2025): It works just fine in 1.0.204 too, I think this isn't version related. There has to be some external factor. [6352 ](https://github.com/sst/opencode/issues/6352)Talks about some proxy, maybe it's related, not sure.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#3801