{"record":{"id":"94b806cc6e547085","repo":"xtekky/gpt4free","slug":"account-not-eligible-for-gemini-code-assist","errorCode":null,"errorMessage":"Account not eligible for Gemini Code Assist.","messagePattern":"Account not eligible for Gemini Code Assist\\.","errorType":"validation","errorClass":"MissingAuthError","httpStatus":403,"severity":"critical","filePath":"g4f/Provider/needs_auth/GeminiCLI.py","lineNumber":621,"sourceCode":"                        if response.ok:\n                            payload = await response.json()\n                            debug.log(f\"Onboarding attempt {attempt + 1}: {payload}\")\n                            managed_project_id = (\n                                payload.get(\"response\", {})\n                                .get(\"cloudaicompanionProject\", {})\n                                .get(\"id\")\n                            )\n                            if payload.get(\"done\") and managed_project_id:\n                                return managed_project_id\n                            if payload.get(\"done\") and project_id:\n                                return project_id\n                        else:\n                            text = await response.text()\n                            debug.error(\n                                f\"Onboarding attempt {attempt + 1} failed with status {response.status}: {text}\"\n                            )\n                            if response.status == 403:\n                                raise MissingAuthError(\n                                    \"Account not eligible for Gemini Code Assist.\"\n                                )\n                        response.raise_for_status()\n            except MissingAuthError:\n                raise\n            except Exception as e:\n                debug.error(f\"Failed to onboard managed project: {e}\")\n\n            await asyncio.sleep(delay_ms / 1000)\n\n        return None\n\n    @staticmethod\n    def _messages_to_gemini_format(\n        messages: list, media: MediaListType\n    ) -> Dict[str, Any]:\n        format_messages = []\n        for msg in messages:","sourceCodeStart":603,"sourceCodeEnd":639,"githubUrl":"https://github.com/xtekky/gpt4free/blob/973504e1770928ed5fb82f43da528f441ad9ddc3/g4f/Provider/needs_auth/GeminiCLI.py#L603-L639","documentation":"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.","triggerScenarios":"onboard_managed_project receives response.status == 403 during any of its up-to-10 attempts; raised immediately, bypassing the remaining retries.","commonSituations":"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').","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"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"from g4f.errors import MissingAuthError\ntry:\n    await provider.generate_async(...)\nexcept MissingAuthError as e:\n    if \"not eligible\" in str(e):\n        alert_operator(\"switch Google account or enable Code Assist for this one\")\n        # do not retry: eligibility will not change","preventionTips":["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"],"tags":["gemini","auth","authorization","onboarding","eligibility"],"backgroundTag":null,"analyzedSha":"973504e1770928ed5fb82f43da528f441ad9ddc3","analyzedAt":"2026-08-14T23:45:32.408Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}