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
Cannot use opencode attach when OPENCODE_SERVER_USERNAME set #25113
Am I able to use this to attach the web server like this?
OPENCODE_SERVER_USERNAME="username" OPENCODE_SERVER_PASSWORD="password" opencode attach http://localhost:4096
But when I do this, it's still showing Unauthorized. Am I miss anything?
Plugins
Nil
OpenCode version
1.14.30
Steps to reproduce
use this command on terminal:
OPENCODE_SERVER_USERNAME="username" OPENCODE_SERVER_PASSWORD="password" opencode attach http://localhost:4096
Makes no sense to have a environment variable like OPENCODE_SERVER_USERNAME if you can't use it anywhere but the Web UI. PR #9095 fixed it ages ago but never got merged
Activity
github-actions commentedon Apr 30, 2026
This issue might be a duplicate of existing issues. Please check:
opencode attachignoresOPENCODE_SERVER_USERNAMEand hardcodes "opencode" as the username — describes the same root cause and symptomsIf your issue is distinct from these, please add more detail explaining the difference.
OpeOginni commentedon Apr 30, 2026
How did you start the server?
jasonwch commentedon Apr 30, 2026
I use this method to start as service
https://gist.github.com/shawnyeager/752ce43e4f8d97f55cd9db397544873f
davereed commentedon May 1, 2026
It's not well documented, but you can do:
opencode attach http://ip:port -p password
jasonwch commentedon May 1, 2026
I mean I have custom username by OPENCODE_SERVER_USERNAME as well
davereed commentedon May 2, 2026
It seems to be hardcoded to the default 'opencode' username. I think your only option would be to unset the custom username.
opencode/packages/opencode/src/cli/cmd/tui/attach.ts
Line 66 in 51e310c
OpeOginni commentedon May 2, 2026
Noticed that too, would need to alert the team
SrHenry commentedon May 3, 2026
Makes no sense to have a environment variable like
OPENCODE_SERVER_USERNAMEif you can't use it anywhere but the Web UI. PR #9095 fixed it ages ago but never got merged