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
Gitlab duo provider is not working with Self Hosted instances. #8655
opencode error when starting the command #8509: opencode error when starting the command - Another GitLab-related error ("TypeError: undefined is not an object (evaluating 'input.id')") that may be related
Feel free to ignore if none of these address your specific case.
Thanks for posting the versions. They are relatively new, which is good. Could you please tell me if you use OAuth or PAT authentication? Could you please try both methods? If it's PAT, make sure it has API access, if PAT is old, try to create a new one and test it.
@vglafirov I created a PAT yesterday with API Access, but I couldn't use Oauth because OpenCode tried to log me in gitlab.com and not the self hosted instance. I'll try again
Another question: Have you tried Duo-CLI ? Does this work for you? It doesn't mean we should not fix OpenCode, it's a part of debug process :) Trying to find the difference.
Another question: Have you tried Duo-CLI ? Does this work for you? It doesn't mean we should not fix OpenCode, it's a part of debug process :) Trying to find the difference.
I just connected duo cli to the instance and try to send a message, it works and it can find my project @vglafirov
Thanks for everyone's input with the mob-debugging. Thanks to this thread I have reproducable steps to get opencode working with Duo in my organisation (on a self-hosted instance).
I can confirm this it is working now. The fix has been merged, but not deployed until this EMEA morning, due to the change lock, preventing weekend deployments. Now it's been deployed and the issue with UID mismatch has gone. @J4NS-R Thanks for testing this.
Enable Duo Agent Platform for the user/group/instance.
Ensure the following feature flags are enabled (root access required. No restart required)
Feature.enabled?(:agent_platform_claude_code)
Feature.enabled?(:third_party_agents_enabled)
I do not know why, but the following env vars must also be set (eg through direnv or .bashrc or export ...)
GITLAB_INSTANCE_URL=https://gitlab.example.com
These two things are required, indeed. The rest, you mention, is not necessary. Token with glpat- prefix will be created automatically on newer versions of GitLab (17+).
You can also specify GITLAB_AI_GATEWAY_URL environment variable, in case you run your own AI Gateway.
I tested opencode with GitLab Duo and it still complains with an error: “GitLabError: Anthropic API error: 403 {“detail”:”Gitlab instance uid mismatch”}”
When using /connect with PAT, the instance url is never asked for which presumably means it will default to gitlab.com instead of using the private instance url
I do NOT want to have to set env vars---this defeats the whole purpose of entering the instance url and the PAT during opencode auth login
allowing oauth to work with private instances would be great
@calebdw Interesting observation, thanks. I am always relying on environment variable, TBH, but you are right, instance URL can be stored in auth storage.I think this issue can be closed, since it's working now. Could you please create a dedicated issue for this usecase?
Okay, now I understand the problem. opencode auth login provides a dialog to specify the instance URL, but when you do /connect, opencode bypasses the auth plugin's prompts and goes directly to gitlab.com, unless you specified GITLAB_INSTANCE_URL environment variable. This needs to be added to Opencode codebase, not to auth plugins. @rekram1-node Do you want me to open an issue to implement this?
Activity
github-actions commentedon Jan 15, 2026
This issue might be a duplicate of existing issues. Please check:
Feel free to ignore if none of these address your specific case.
gaetan-puleo commentedon Jan 15, 2026
@vglafirov I created an issue for Gitlab instances
vglafirov commentedon Jan 15, 2026
@gaetan-puleo Could you please provide GitLab version you are currently running?
gaetan-puleo commentedon Jan 15, 2026
@vglafirov v18.6.1-ee
NicFontana commentedon Jan 15, 2026
Same here on v18.7.1-ee
vglafirov commentedon Jan 15, 2026
Thanks for posting the versions. They are relatively new, which is good. Could you please tell me if you use OAuth or PAT authentication? Could you please try both methods? If it's PAT, make sure it has API access, if PAT is old, try to create a new one and test it.
gaetan-puleo commentedon Jan 15, 2026
@vglafirov I created a PAT yesterday with API Access, but I couldn't use Oauth because OpenCode tried to log me in gitlab.com and not the self hosted instance. I'll try again
gaetan-puleo commentedon Jan 15, 2026
Same behavior using /connect and selecting gitlab duo (oauth method)
gaetan-puleo commentedon Jan 15, 2026
When using "opencode auth login" I can enter a gitlab instance URL. Ok we need to avoid using /connect when opencode is running.
gaetan-puleo commentedon Jan 15, 2026
"Client authentication failed due to unknown client, no client authentication included, or unsupported authentication method."
I guess oauth is not possible with my instance
vglafirov commentedon Jan 15, 2026
Yeah, for OAuth you might need to register your own application. I am currently investingating this. I will keep you posted.
vglafirov commentedon Jan 15, 2026
Another question: Have you tried Duo-CLI ? Does this work for you? It doesn't mean we should not fix OpenCode, it's a part of debug process :) Trying to find the difference.
gaetan-puleo commentedon Jan 15, 2026
I just connected duo cli to the instance and try to send a message, it works and it can find my project @vglafirov
28 remaining items
plutowang commentedon Jan 19, 2026
Hi @vglafirov, I noticed that the MR has merged and the AI Gateway has released a new version. Here’s the link: https://gitlab.com/gitlab-org/modelops/applied-ml/code-suggestions/ai-assist/-/releases/v1.261.2. However, I tested opencode with GitLab Duo and it still complains with an error: “GitLabError: Anthropic API error: 403 {“detail”:”Gitlab instance uid mismatch”}”
NicFontana commentedon Jan 19, 2026
I now get this error:
J4NS-R commentedon Jan 19, 2026
Hi all
Thanks for everyone's input with the mob-debugging. Thanks to this thread I have reproducable steps to get opencode working with Duo in my organisation (on a self-hosted instance).
Steps:
Feature.enabled?(:agent_platform_claude_code)Feature.enabled?(:third_party_agents_enabled)glpat-set (Admin > Settings > General > Account and limit > Access token prefix)apiandai_featuresscopes.opencode auth loginin your terminal (do not use/connectcommand)direnvor.bashrcorexport ...)GITLAB_INSTANCE_URL=https://gitlab.example.comGITLAB_TOKEN=glpat-xxxxx/modelsto select one of the models under Duo, and Bob's your uncle.Versions:
opencode 1.1.19Gitlab v18.7.1-eevglafirov commentedon Jan 19, 2026
I can confirm this it is working now. The fix has been merged, but not deployed until this EMEA morning, due to the change lock, preventing weekend deployments. Now it's been deployed and the issue with UID mismatch has gone. @J4NS-R Thanks for testing this.
These two things are required, indeed. The rest, you mention, is not necessary. Token with
glpat-prefix will be created automatically on newer versions of GitLab (17+).You can also specify
GITLAB_AI_GATEWAY_URLenvironment variable, in case you run your own AI Gateway.NicFontana commentedon Jan 19, 2026
Thanks a lot @J4NS-R, it is working now.
On my side, the only thing missing was the
opencode auth loginpart.vglafirov commentedon Jan 19, 2026
@rekram1-node This issue can be closed. It's working now. Updated documentation as follow-up MR
vglafirov commentedon Jan 19, 2026
opencode auth logincommand does the same as/connect, stores PAT inauth.jsonfile.Pipyakas commentedon Jan 21, 2026
Im having this error too, GitLab
v18.6.1-eevglafirov commentedon Jan 21, 2026
@Pipyakas Please, go to the Admin area of your instance and execute a health check, GitLab Duo -> "Run health check", make sure everything is 🟢
calebdw commentedon Jan 21, 2026
There's still a few issues:
/connectwith PAT, the instance url is never asked for which presumably means it will default togitlab.cominstead of using the private instance urlopencode auth loginvglafirov commentedon Jan 21, 2026
@calebdw Interesting observation, thanks. I am always relying on environment variable, TBH, but you are right, instance URL can be stored in auth storage.I think this issue can be closed, since it's working now. Could you please create a dedicated issue for this usecase?
cc: @rekram1-node
rekram1-node commentedon Jan 21, 2026
Yeah we should have additional prompt for it
vglafirov commentedon Jan 22, 2026
Okay, now I understand the problem.
opencode auth loginprovides a dialog to specify the instance URL, but when you do/connect, opencode bypasses the auth plugin's prompts and goes directly to gitlab.com, unless you specifiedGITLAB_INSTANCE_URLenvironment variable. This needs to be added to Opencode codebase, not to auth plugins. @rekram1-node Do you want me to open an issue to implement this?gaetan-puleo commentedon Jan 26, 2026
I close this issue, I don't have access to the endpoint.