xtekky/gpt4free · critical · MissingAuthError
Account not eligible for Gemini Code Assist.
Error message
Account not eligible for Gemini Code Assist.
What it means
During onboarding of the managed free-tier project, the Code Assist endpoint returned HTTP 403, which the provider maps to MissingAuthError('Account not eligible for Gemini Code Assist.'). A 403 at onboarding means Google rejected the account for the Code Assist program itself, so no amount of token refresh will help.
Source
Thrown at g4f/Provider/needs_auth/GeminiCLI.py:621
if response.ok:
payload = await response.json()
debug.log(f"Onboarding attempt {attempt + 1}: {payload}")
managed_project_id = (
payload.get("response", {})
.get("cloudaicompanionProject", {})
.get("id")
)
if payload.get("done") and managed_project_id:
return managed_project_id
if payload.get("done") and project_id:
return project_id
else:
text = await response.text()
debug.error(
f"Onboarding attempt {attempt + 1} failed with status {response.status}: {text}"
)
if response.status == 403:
raise MissingAuthError(
"Account not eligible for Gemini Code Assist."
)
response.raise_for_status()
except MissingAuthError:
raise
except Exception as e:
debug.error(f"Failed to onboard managed project: {e}")
await asyncio.sleep(delay_ms / 1000)
return None
@staticmethod
def _messages_to_gemini_format(
messages: list, media: MediaListType
) -> Dict[str, Any]:
format_messages = []
for msg in messages:View on GitHub (pinned to 973504e177)
Solutions
- Sign in with a different Google account that is eligible for Gemini Code Assist (re-run GeminiCLI.login)
- If on Google Workspace, have the admin enable Gemini or Code Assist for the account
- Set GEMINI_PROJECT_ID to an already-entitled project so onboarding is skipped
- Verify region availability for Gemini Code Assist
Defensive patterns
Strategy: try-catch
Try / catch
from g4f.errors import MissingAuthError
try:
await provider.generate_async(...)
except MissingAuthError as e:
if "not eligible" in str(e):
alert_operator("switch Google account or enable Code Assist for this one")
# do not retry: eligibility will not change Prevention
- Test the account once via the official Gemini CLI before wiring it into g4f
- Workspace admins: enable Gemini apps / Code Assist for users
- Catch MissingAuthError separately from generic RuntimeErrors; it is not retryable
When it happens
Trigger: onboard_managed_project receives response.status == 403 during any of its up-to-10 attempts; raised immediately, bypassing the remaining retries.
Common situations: Personal Google account in an unsupported region or workspace policy blocking Code Assist; Google Workspace admin disabled Gemini; account flagged; trying to use a paid-only account on the free-tier path (tier_id='free-tier').
Related errors
- Account not eligible for Antigravity Code Assist.
- No refresh token found in GCP_SERVICE_ACCOUNT.
- Token refresh failed: {text}
- No access_token in refresh response.
- No project information found in API response.
AI-assisted analysis of xtekky/gpt4free@973504e177 (2026-08-14).
Data as JSON: /api/errors/94b806cc6e547085.
Report an issue: GitHub.