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
opencode run --attach ignores OPENCODE_SERVER_PASSWORD #16096
When using opencode run --attach=localhost:<port> with OPENCODE_SERVER_USERNAME and OPENCODE_SERVER_PASSWORD env vars, the
command fails with "Error: Session not found".
The run command in packages/opencode/src/cli/cmd/run.ts (~line 650) does
not pass auth headers to createOpencodeClient:
if(args.attach){constsdk=createOpencodeClient({baseUrl: args.attach, directory })// No auth headers passed!returnawaitexecute(sdk)}
The attach TUI command correctly builds Basic auth headers from the env vars
(in packages/opencode/src/cli/cmd/tui/attach.ts), but run does not.
Plugins
No response
OpenCode version
1.2.17
Steps to reproduce
Start a server with auth: OPENCODE_SERVER_PASSWORD=secret opencode serve --port 4096
Run: OPENCODE_SERVER_USERNAME=opencode OPENCODE_SERVER_PASSWORD=secret opencode --attach=localhost:4096 run hello
Get: Error: Session not found
Compare with opencode attach localhost:4096 -p secret which works fine
because attach.ts passes auth headers to the SDK client.
changed the title [-]`opencode run --attach` ignores OPENCODE_SERVER_PASSWORD auth[/-][+]`opencode run --attach` ignores OPENCODE_SERVER_PASSWORD[/+]on Mar 5, 2026
Activity
[-]`opencode run --attach` ignores OPENCODE_SERVER_PASSWORD auth[/-][+]`opencode run --attach` ignores OPENCODE_SERVER_PASSWORD[/+]github-actions commentedon Mar 5, 2026
This issue might be a duplicate of existing issues. Please check:
Authorizationheader whenOPENCODE_SERVER_PASSWORDis set — same root pattern but for the plugin client rather thanrun --attachopencode runfailing withSession not found— same error message, though the root cause there appears to be unrelated to authFix: `opencode run --attach` should pass auth headers from env vars