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
TOKEN_REFRESH_NEEDED error incorrectly thrown for context overflow (400 prompt too long) #12135
The core issue here is that GitLab provider error handling incorrectly throws TOKEN_REFRESH_NEEDED for 400 context overflow errors instead of actual 401 authentication errors. This is similar to token refresh issues reported in #9711 and #9949, but specific to error classification.
Feel free to ignore if none of these address your specific case.
Related: PR #8810 adds context overflow prevention with pre-flight token estimation, which would catch this before the request is sent. That PR has been open since Jan 16 - merging it would prevent this class of misleading errors.
Would still be better not to obfuscate the true cause though.
Activity
github-actions commentedon Feb 4, 2026
This issue might be a duplicate of existing issues. Please check:
The core issue here is that GitLab provider error handling incorrectly throws TOKEN_REFRESH_NEEDED for 400 context overflow errors instead of actual 401 authentication errors. This is similar to token refresh issues reported in #9711 and #9949, but specific to error classification.
Feel free to ignore if none of these address your specific case.
OddballGreg commentedon Feb 4, 2026
Related: PR #8810 adds context overflow prevention with pre-flight token estimation, which would catch this before the request is sent. That PR has been open since Jan 16 - merging it would prevent this class of misleading errors.
Would still be better not to obfuscate the true cause though.
fix(provider): bump @gitlab/gitlab-ai-provider to 3.4.1
fix: detect context overflow errors before token refresh