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
[BUG] Plugin client missing Authorization header when OPENCODE_SERVER_PASSWORD is set #9706
When OPENCODE_SERVER_PASSWORD is set, the client passed to plugins via PluginInput does not include the Authorization header, causing all plugin API calls (like ctx.client.session.create()) to fail with 401 Unauthorized.
The symptoms and root cause appear to be identical - the plugin client is missing the Authorization header when OPENCODE_SERVER_PASSWORD is set. Feel free to ignore if this addresses a specific case not covered by #8676.
Thanks for the detailed bug report and excellent analysis @uf-hy! You've correctly identified the root cause.
This is a confirmed bug and is related to #8676 (which covers the Desktop/Tauri case). There's already an open PR #9095 that addresses TUI auth when using HTTP mode, but it doesn't fix the plugin client path you've identified in plugin/index.ts.
Your analysis is spot-on:
worker.ts correctly uses getAuthorizationHeader() to add Basic Auth
plugin/index.ts creates the client without any auth headers
Next Steps:
We'll either extend PR #9095 to also fix the plugin client, or create a separate targeted fix. The fix is straightforward - using a similar fetchWithAuth wrapper like the TUI worker does.
For now, the workaround is to not set OPENCODE_SERVER_PASSWORD when using plugins that make SDK API calls, or use the CLI without the server password when testing plugins.
Linking this to #8676 for tracking. Thanks for the clear reproduction steps!
Info for maintainers: This fix for the plugin authorization issue was incorporated into the pr #9095 - which solves the auth issue when a server-password is set for the
I'm still experiencing this issue. While adding a server from the UI, the endpoint gets something like:
2026-06-05 14:57:40 [WARN]
The 'Authorization' header is present but not in the expected form 'Authorization: Bearer $LM_API_TOKEN'. The provided value cannot be used.
Apparently not replacing that with the proper token.
Setting Bearer or not before the token doesn't change anything.
Activity
github-actions commentedon Jan 20, 2026
This issue might be a duplicate of existing issues. Please check:
The symptoms and root cause appear to be identical - the plugin client is missing the Authorization header when OPENCODE_SERVER_PASSWORD is set. Feel free to ignore if this addresses a specific case not covered by #8676.
R44VC0RP commentedon Jan 20, 2026
Thanks for the detailed bug report and excellent analysis @uf-hy! You've correctly identified the root cause.
This is a confirmed bug and is related to #8676 (which covers the Desktop/Tauri case). There's already an open PR #9095 that addresses TUI auth when using HTTP mode, but it doesn't fix the plugin client path you've identified in
plugin/index.ts.Your analysis is spot-on:
worker.tscorrectly usesgetAuthorizationHeader()to add Basic Authplugin/index.tscreates the client without any auth headersNext Steps:
We'll either extend PR #9095 to also fix the plugin client, or create a separate targeted fix. The fix is straightforward - using a similar
fetchWithAuthwrapper like the TUI worker does.For now, the workaround is to not set
OPENCODE_SERVER_PASSWORDwhen using plugins that make SDK API calls, or use the CLI without the server password when testing plugins.Linking this to #8676 for tracking. Thanks for the clear reproduction steps!
LeonMueller-OneAndOnly commentedon Jan 31, 2026
Info for maintainers: This fix for the plugin authorization issue was incorporated into the pr #9095 - which solves the auth issue when a server-password is set for the
david-christ commentedon Mar 1, 2026
As a temporary workaround when using the SDK, e.g. to write plugins, you can do this (messing with "private" methods):
github-actions commentedon May 1, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.
xarathos86 commentedon Jun 5, 2026
I'm still experiencing this issue. While adding a server from the UI, the endpoint gets something like:
2026-06-05 14:57:40 [WARN]
The 'Authorization' header is present but not in the expected form 'Authorization: Bearer $LM_API_TOKEN'. The provided value cannot be used.
Apparently not replacing that with the proper token.
Setting Bearer or not before the token doesn't change anything.
joeyism commentedon Sep 2, 2026
I'm also still experiencing this when using NVIDIA NIM