decolua/9router · error · Error
Failed to onboard user: ${errorText}
Error message
Failed to onboard user: ${errorText} What it means
Thrown by AntigravityService.onboardUser when the POST to the Gemini Code Assist onboarding endpoint (onboardUserEndpoint) returns a non-2xx HTTP status. The raw upstream response body is embedded in the message so the underlying Google API error (quota, permission, invalid tier) is visible. It surfaces through completeOnboarding's retry loop, so it fires up to maxRetries times per connect().
Source
Thrown at src/lib/oauth/services/antigravity.js:148
}
}
return { projectId, tierId, raw: data };
}
/**
* Onboard user to enable Gemini Code Assist for the project
*/
async onboardUser(accessToken, projectId, tierId) {
const response = await fetch(this.config.onboardUserEndpoint, {
method: "POST",
headers: this.getApiHeaders(accessToken),
body: JSON.stringify({ tierId, metadata: this.getMetadata() }),
});
if (!response.ok) {
const errorText = await response.text();
throw new Error(`Failed to onboard user: ${errorText}`);
}
return await response.json();
}
/**
* Complete onboarding flow with retry
*/
async completeOnboarding(accessToken, projectId, tierId, maxRetries = 10) {
for (let i = 0; i < maxRetries; i++) {
const result = await this.onboardUser(accessToken, projectId, tierId);
if (result.done === true) {
// Extract final project ID from response
let finalProjectId = projectId;
if (result.response?.cloudaicompanionProject) {
const respProject = result.response.cloudaicompanionProject;
if (typeof respProject === 'string') {View on GitHub (pinned to 90b52e06ff)
Solutions
- Read the errorText in the message — it contains Google's actual error JSON/status; fix that root cause first
- Verify the GCP project has the Gemini Code Assist / Cloud AI Companion API enabled and your account is on an allowed tier
- Re-run the connect flow to obtain a fresh access token (the old one may have expired or lack scopes)
- Retry later if the message shows a 5xx/rate-limit — completeOnboarding already retries 10x over ~50 seconds
Example fix
// before: raw error text only
throw new Error(`Failed to onboard user: ${errorText}`);
// after: catch and add context for the user
try {
return await this.onboardUser(accessToken, projectId, tierId);
} catch (e) {
throw new Error(`Onboarding failed for project ${projectId}: ${e.message}`);
} Defensive patterns
Strategy: try-catch
Validate before calling
const res = await fetch(loadEndpoint, { method:'POST', headers: apiHeaders(token), body: JSON.stringify({ metadata }) });
if (res.ok) { const d = await res.json(); if (!d.cloudaicompanionProject && !d.allowedTiers) console.warn('Account may not be Code Assist provisioned — onboarding will likely fail'); } Type guard
function hasProjectId(r) { return r && (typeof r.cloudaicompanionProject === 'string' || (r.cloudaicompanionProject && typeof r.cloudaicompanionProject.id === 'string')); } Try / catch
try {
await service.completeOnboarding(token, projectId, tierId);
} catch (e) {
if (e.message.startsWith('Failed to onboard user')) {
// parse embedded Google error body from e.message; check API enablement/scopes before retrying
} else throw e;
} Prevention
- Enable the Cloud AI Companion / Gemini Code Assist API on the target GCP project before connecting
- Request the full required OAuth scopes (cloud-platform) during authorize
- Check Google Workspace status page during suspected outages before long retry loops
- Log the embedded errorText body — it contains Google's exact reason code
When it happens
Trigger: Google's onboardUser endpoint responds 4xx/5xx — e.g. invalid tierId, the GCP project lacks Cloud AI Companion API enabled, the OAuth token lacks the cloud-platform scope, or Google returns a transient 500 on every one of the 10 retries.
Common situations: First-time `9router` antigravity connect on a fresh Google account with no Gemini Code Assist tier; org-policy blocks the Cloud AI Companion API; expired access token mid-flow; Google-side outage during the 50-second retry window.
Related errors
- Onboarding timeout - please try again
- Vertex: failed to mint access token from Service Account JSO
- Vertex: failed to refresh access token from ADC JSON (author
- loadCodeAssist failed: HTTP ${response.status} ${errorText.s
- onboardUser HTTP ${response.status}: ${errorText.slice(0, 20
AI-assisted analysis of decolua/9router@90b52e06ff (2026-08-30).
Data as JSON: /api/errors/ed5fbb6f8828cc93.
Report an issue: GitHub.