GitLab provider: direct access token minting fails on gitlab.com with 503 Token creation failed #8730

Closed
opened 2026-02-16 18:10:41 -05:00 by yindo · 6 comments
Owner

Originally created by @vim-zsh on GitHub (Feb 6, 2026).

Originally assigned to: @rekram1-node on GitHub.

Summary

Using OpenCode with GitLab models on gitlab.com consistently fails before the model call with:

GitLabError: Failed to get direct access token: 503 Service Unavailable - {"message":"Token creation failed"}

OAuth login succeeds and token validity is confirmed (GET /api/v4/user returns 200), but direct access token minting fails (POST /api/v4/ai/third_party_agents/direct_access returns 503).

Environment

  • OpenCode version: 1.1.53
  • GitLab auth plugin: @gitlab/opencode-gitlab-auth@1.3.2
  • GitLab AI provider observed in logs: @gitlab/gitlab-ai-provider@3.4.0
  • Target model: gitlab/duo-chat-opus-4-5
  • GitLab host: gitlab.com

Reproduction

  1. Authenticate GitLab in OpenCode (OAuth flow completes successfully).
  2. Run:
    • opencode run -m gitlab/duo-chat-opus-4-5 "hi"
  3. Observe direct access token error.

Direct API check (outside OpenCode)

export GITLAB_TOKEN="<oauth access token>"

curl -i -sS "https://gitlab.com/api/v4/user" \
  -H "Authorization: Bearer $GITLAB_TOKEN"

curl -i -sS -X POST "https://gitlab.com/api/v4/ai/third_party_agents/direct_access" \
  -H "Authorization: Bearer $GITLAB_TOKEN" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -d "{}"

Actual result

  • GET /api/v4/user -> HTTP/2 200
  • POST /api/v4/ai/third_party_agents/direct_access -> HTTP/2 503 with:
{"message":"Token creation failed"}

Response metadata from failing call

  • x-request-id: 9c9c99cce39dfeab-ATL
  • x-gitlab-meta: {"correlation_id":"9c9c99cce39dfeab-ATL","version":"1"}
  • gitlab-sv: ai-assisted-gke-us-east1-b

OpenCode log excerpt

GitLabError: Failed to get direct access token: 503 Service Unavailable - {"message":"Token creation failed"}
  at getDirectAccessToken (.../@gitlab/gitlab-ai-provider/dist/index.mjs:108:19)

Notes

  • Reproduced on a newly created GitLab account with new subscription as well.
  • Suggestion: if possible, surface request ID/correlation ID in the user-facing error to make support debugging easier.
Originally created by @vim-zsh on GitHub (Feb 6, 2026). Originally assigned to: @rekram1-node on GitHub. ### Summary Using OpenCode with GitLab models on gitlab.com consistently fails before the model call with: ``` GitLabError: Failed to get direct access token: 503 Service Unavailable - {"message":"Token creation failed"} ``` OAuth login succeeds and token validity is confirmed (`GET /api/v4/user` returns 200), but direct access token minting fails (`POST /api/v4/ai/third_party_agents/direct_access` returns 503). ### Environment - OpenCode version: `1.1.53` - GitLab auth plugin: `@gitlab/opencode-gitlab-auth@1.3.2` - GitLab AI provider observed in logs: `@gitlab/gitlab-ai-provider@3.4.0` - Target model: `gitlab/duo-chat-opus-4-5` - GitLab host: `gitlab.com` ### Reproduction 1. Authenticate GitLab in OpenCode (OAuth flow completes successfully). 2. Run: - `opencode run -m gitlab/duo-chat-opus-4-5 "hi"` 3. Observe direct access token error. ### Direct API check (outside OpenCode) ```bash export GITLAB_TOKEN="<oauth access token>" curl -i -sS "https://gitlab.com/api/v4/user" \ -H "Authorization: Bearer $GITLAB_TOKEN" curl -i -sS -X POST "https://gitlab.com/api/v4/ai/third_party_agents/direct_access" \ -H "Authorization: Bearer $GITLAB_TOKEN" \ -H "Content-Type: application/json" \ -H "Accept: application/json" \ -d "{}" ``` ### Actual result - `GET /api/v4/user` -> `HTTP/2 200` - `POST /api/v4/ai/third_party_agents/direct_access` -> `HTTP/2 503` with: ```json {"message":"Token creation failed"} ``` ### Response metadata from failing call - `x-request-id: 9c9c99cce39dfeab-ATL` - `x-gitlab-meta: {"correlation_id":"9c9c99cce39dfeab-ATL","version":"1"}` - `gitlab-sv: ai-assisted-gke-us-east1-b` ### OpenCode log excerpt ``` GitLabError: Failed to get direct access token: 503 Service Unavailable - {"message":"Token creation failed"} at getDirectAccessToken (.../@gitlab/gitlab-ai-provider/dist/index.mjs:108:19) ``` ### Notes - Reproduced on a newly created GitLab account with new subscription as well. - Suggestion: if possible, surface request ID/correlation ID in the user-facing error to make support debugging easier.
yindo closed this issue 2026-02-16 18:10:41 -05:00
Author
Owner

@raflyazf commented on GitHub (Feb 6, 2026):

Same issue, sometimes this 503 error occured on using gitlab models.

@raflyazf commented on GitHub (Feb 6, 2026): Same issue, sometimes this 503 error occured on using gitlab models.
Author
Owner

@vim-zsh commented on GitHub (Feb 7, 2026):

Thanks for confirming you are seeing this too. Have you been able to resolve it on your side? If yes, would you mind sharing the exact steps or configuration that fixed it? It would be very helpful.

@vim-zsh commented on GitHub (Feb 7, 2026): Thanks for confirming you are seeing this too. Have you been able to resolve it on your side? If yes, would you mind sharing the exact steps or configuration that fixed it? It would be very helpful.
Author
Owner

@raflyazf commented on GitHub (Feb 8, 2026):

Asking some LLMs with this issue, they said on the Gitlab server-side are blocking the request if we don't have any credits.

Still figuring and confirming this out until today.

@raflyazf commented on GitHub (Feb 8, 2026): Asking some LLMs with this issue, they said on the Gitlab server-side are blocking the request if we don't have any credits. Still figuring and confirming this out until today.
Author
Owner

@rekram1-node commented on GitHub (Feb 8, 2026):

@vglafirov (tagging for visibility, apologies)

@rekram1-node commented on GitHub (Feb 8, 2026): @vglafirov (tagging for visibility, apologies)
Author
Owner

@raflyazf commented on GitHub (Feb 10, 2026):

Image

somehow it working now @vim-zsh

@raflyazf commented on GitHub (Feb 10, 2026): <img width="2032" height="1161" alt="Image" src="https://github.com/user-attachments/assets/4e0109a6-9366-4483-8172-aa622c4b7918" /> somehow it working now @vim-zsh
Author
Owner

@vim-zsh commented on GitHub (Feb 10, 2026):

Confirmed working now as well. Thanks for the update @raflyazf!

@vim-zsh commented on GitHub (Feb 10, 2026): Confirmed working now as well. Thanks for the update @raflyazf!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#8730