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
cli: TUI fails to connect to password-protected explicit server via --server #49427
opencode --server <url> against a password-protected opencode serve always fails the startup health check with UnsupportedContentType, in all credential forms. The same URL works with opencode run and opencode api, so the server side is fine — only the TUI startup path fails.
Environment
opencode version: 2.0.5
OS: Linux 7.2.6-arch2-1 (linux x64)
Terminal: Unavailable: terminal environment variables are not set
Shell: /usr/bin/bash
Install/channel: latest
Active plugins: Omitted at reporter's request
Reproduction
Start a password-protected server: opencode serve --hostname 0.0.0.0 --port 4096 with OPENCODE_SERVER_PASSWORD set.
Run opencode --server http://127.0.0.1:4096 — fails.
Retry with credentials in URL (http://opencode:<pass>@127.0.0.1:4096) and as ?auth_token=<base64(user:pass)> — both fail identically.
Run opencode run --server "<auth_token form>" "hi" — succeeds. opencode api --server "<userinfo form>" get /api/status — succeeds.
Expected Behavior
The TUI connects to the explicit server the same way run and api do.
Actual Behavior
Error: Server at http://127.0.0.1:4096 did not provide a compatible V2 health response ... [cause]: ClientError: UnsupportedContentType
Unauthenticated /api/status returns 401 with an empty body, so the TUI check appears to send no credentials in any URL form.
Additional Context
The cli.json schema has no default-server field, so --server cannot be defaulted; aliases/functions are the only workaround, and they hit this bug.
No doc describes TUI --server authentication (CLI, Web, Commands, and client guides checked).
This issue might be a duplicate of existing issues. Please check:
v2 serve: configured Basic Auth credentials always return 401 #45856: v2 serve: configured Basic Auth credentials always return 401 — also covers authentication failures against a password-protected opencode serve endpoint, though that issue focuses on Basic Auth always rejecting valid credentials while this one specifically identifies that the TUI --server startup path sends no credentials at all.
If these are the same root cause, it may make sense to consolidate. If the underlying credential-sending bug in the TUI is distinct from the server-side auth rejection, both are worth tracking separately.
Thanks for the detailed report! I reproduced this on 2.0.5. A password-protected server answers the client's health check with a 401 that has no body, so the client can't tell it's an authentication error. Instead of saying a password is needed, it fails with the generic did not provide a compatible V2 health response ... UnsupportedContentType.
On the latest dev (950111ff2) the server's 401 says what it is, and opencode --server <url> now fails with Server at <url> requires a password; set OPENCODE_PASSWORD. So this is likely already fixed, and the fix should be in the next release.
On both versions, the TUI takes the password from the environment rather than from the URL. This works on 2.0.5 too:
Closing this as completed, since there's been no reply in the day since the last update. On 2.0.5, a password-protected server's 401 has no body, so opencode --server showed the generic UnsupportedContentType health-check error. On the latest dev (950111ff2) it says requires a password; set OPENCODE_PASSWORD instead, so the fix should be in the next release. Until then, setting OPENCODE_PASSWORD=<pass> in the shell where you run opencode --server lets the TUI connect.
If this still happens on a newer version, please comment here or open a new issue. If you'd like the TUI to accept credentials in the URL, a separate feature request is welcome. Thanks for the detailed report!
Activity
github-actions commentedon Sep 17, 2026
This issue might be a duplicate of existing issues. Please check:
opencode serveendpoint, though that issue focuses on Basic Auth always rejecting valid credentials while this one specifically identifies that the TUI--serverstartup path sends no credentials at all.If these are the same root cause, it may make sense to consolidate. If the underlying credential-sending bug in the TUI is distinct from the server-side auth rejection, both are worth tracking separately.
opencodejr commentedon Oct 28, 2026
Thanks for the detailed report! I reproduced this on 2.0.5. A password-protected server answers the client's health check with a 401 that has no body, so the client can't tell it's an authentication error. Instead of saying a password is needed, it fails with the generic
did not provide a compatible V2 health response ... UnsupportedContentType.On the latest
dev(950111ff2) the server's 401 says what it is, andopencode --server <url>now fails withServer at <url> requires a password; set OPENCODE_PASSWORD. So this is likely already fixed, and the fix should be in the next release.On both versions, the TUI takes the password from the environment rather than from the URL. This works on 2.0.5 too:
If you also want URL credentials (
user:pass@or?auth_token=) to work for the TUI, please open a separate feature request.Related: #55558 (docs request for server deployment and passwords).
The bot will close this issue in 1 day unless you reply that it still happens, e.g. on a newer version.
alex-mashin commentedon Oct 28, 2026
This is likely to be caused by #45856. It is not fixed and this is time that a human attends to the bug.
opencodejr commentedon Oct 29, 2026
Closing this as completed, since there's been no reply in the day since the last update. On 2.0.5, a password-protected server's 401 has no body, so
opencode --servershowed the genericUnsupportedContentTypehealth-check error. On the latestdev(950111ff2) it saysrequires a password; set OPENCODE_PASSWORDinstead, so the fix should be in the next release. Until then, settingOPENCODE_PASSWORD=<pass>in the shell where you runopencode --serverlets the TUI connect.If this still happens on a newer version, please comment here or open a new issue. If you'd like the TUI to accept credentials in the URL, a separate feature request is welcome. Thanks for the detailed report!