anomalyco / anomalyco/opencode
v2 serve: configured Basic Auth credentials always return 401
@neriousy is already working on this.
Since Aug 28, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Summary
opencode2 serve rejects the exact HTTP Basic Auth username and password supplied through OPENCODE_SERVER_USERNAME and OPENCODE_SERVER_PASSWORD. In a browser, this causes an endless login prompt and prevents using serve with fixed credentials.
Environment
- opencode version:
opencode2 v0.0.0-beta-18414 - OS:
Linux 7.0.0-30-generic x86_64(Ubuntu) - Terminal:
TERM=xterm-256color,COLORTERM=truecolor, Herdr terminal environment - Shell:
/bin/bash - Install/channel: beta binary installed at
~/.opencode/bin/opencode2 - Active plugins: local
.opencode/plugins/smoke-theme.jsonand.opencode/plugins/tui-smoke.tsx; no plugins configured in the global config
Reproduction
-
Start a fresh server with known credentials:
OPENCODE_SERVER_USERNAME=testuser OPENCODE_SERVER_PASSWORD=testpass opencode2 serve --port 4197 -
Confirm that both variables are present in the running server process.
-
Request the health endpoint with those exact credentials:
curl -u testuser:testpass http://127.0.0.1:4197/api/health -
Open
http://127.0.0.1:4197in a browser and enter the same credentials.
Expected Behavior
The configured credentials authenticate successfully, the health request returns 200, and the web UI loads after one login prompt.
Actual Behavior
The authenticated health request returns 401. The server log records repeated responses such as:
http.method=GET http.url=/api/health http.status=401
http.method=GET http.url=/ http.status=401
The browser keeps showing the Basic Auth login prompt after the correct credentials are entered.
Additional Context
- Reproduces consistently with a clean temporary server and known test credentials.
- The exact credentials read from the running process environment also return
401, ruling out shell quoting and browser credential caching. opencode2 paircredentials authenticate successfully against the managed background service, but they do not authenticate against the explicitserveendpoint.- The managed-service pairing workflow is not equivalent to running a stable
serveendpoint with user-selected credentials. - No secrets or real credentials are included above.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.