anomalyco / anomalyco/opencode

cli: TUI fails to connect to password-protected explicit server via --server

Open
#49,427 1 comment 0 reactions 1 assignee View on GitHub

@simonklee is already working on this.

Since Sep 17, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

Summary

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

  1. Start a password-protected server: opencode serve --hostname 0.0.0.0 --port 4096 with OPENCODE_SERVER_PASSWORD set.
  2. Run opencode --server http://127.0.0.1:4096 — fails.
  3. Retry with credentials in URL (http://opencode:<pass>@127.0.0.1:4096) and as ?auth_token=<base64(user:pass)> — both fail identically.
  4. 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).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.