-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Description
Problem (one or two sentences)
RooCode fails with "Could not refresh access token" error when using Gemini 2.5 Flash via Vertex AI, while direct API calls from PowerShell using the same credentials succeed.
Context (who is affected and when)
This affects users on Windows trying to use Gemini models through Vertex AI. The issue occurs with both ADC (Application Default Credentials) and service account key authentication methods.
Reproduction steps
- Install Google Cloud SDK and set up ADC
gcloud auth application-default login-
Verify required permissions and APIs are enabled
- IAM permissions: Owner role (or minimum Vertex AI User)
- Vertex AI API is enabled
- Billing account is active
-
Test direct API call via PowerShell (confirm it succeeds)
$token = gcloud auth application-default print-access-token
$headers = @{
"Authorization" = "Bearer $token"
"Content-Type" = "application/json"
}
$body = @{
contents = @{
role = "user"
parts = @{ text = "Hello" }
}
} | ConvertTo-Json -Depth 10
Invoke-RestMethod -Method Post -Uri "https://us-central1-aiplatform.googleapis.com/v1/projects/${project-id}/locations/us-central1/publishers/google/models/gemini-2.5-flash:generateContent" -Headers $headers -Body $body-
Configure RooCode with the following settings
- API Provider: GCP Vertex AI
- Google Cloud Credentials: Empty
- Google Cloud Key File Path: Empty
- Google Cloud Project ID: ${project-id}
- Google Cloud Region: us-central1
- Model: gemini-2.5-flash
-
Send a simple prompt in RooCode (e.g., "Hello")
Expected result
Since PowerShell API calls succeed, RooCode should successfully connect to Gemini 2.5 Flash via Vertex AI and return a response.
Actual result
Error message is displayed and API request fails: API Request Failed Gemini generate context stream error: Could not refresh access token:
Variations tried (optional)
Tried all of the following variations, all resulted in the same error:
Authentication methods:
- Application Default Credentials (ADC)
- Direct paste of service account key JSON
- Service account key file path specification
Configuration changes:
- Region change: asia-northeast1 → us-central1
- Created new service account
- Regenerated ADC tokens (revoke → re-login)
Environment:
- Complete VS Code restart
- PC reboot
Workaround that works:
- Using Google Gemini API (direct API, not via Vertex AI)
### App Version*
v3.29.3
### API Provider (optional)
GCP Vertex AI
### Model Used (optional)
gemini-2.5-flash
### App Version
v3.29.3
### API Provider (optional)
Google Vertex AI
### Model Used (optional)
gemini-2.5-flash
### Roo Code Task Links (optional)
_No response_
### Relevant logs or errors (optional)
```shell
Metadata
Metadata
Assignees
Labels
Type
Projects
Status