{"record":{"id":"5a3a96c49e9c2224","repo":"xtekky/gpt4free","slug":"no-project-information-found-in-api-response","errorCode":null,"errorMessage":"No project information found in API response.","messagePattern":"No project information found in API response\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"g4f/Provider/needs_auth/GeminiCLI.py","lineNumber":549,"sourceCode":"        try:\n            load_response = await self.auth_manager.call_endpoint(\n                \"loadCodeAssist\",\n                {\n                    \"cloudaicompanionProject\": \"default-project\",\n                    \"metadata\": {\"duetProject\": \"default-project\"},\n                },\n            )\n            project = load_response.get(\"cloudaicompanionProject\")\n            if project:\n                self._project_id = project\n                return project\n            project = await self.onboard_managed_project(\n                access_token=self.auth_manager.get_access_token(), tier_id=\"free-tier\"\n            )\n            if project:\n                self._project_id = project\n                return project\n            raise RuntimeError(\"No project information found in API response.\")\n        except MissingAuthError:\n            raise\n        except Exception as e:\n            debug.error(f\"Failed to discover project ID: {e}\")\n            raise RuntimeError(\n                \"Could not discover project ID. Ensure authentication or set GEMINI_PROJECT_ID.\"\n            )\n\n    async def onboard_managed_project(\n        self,\n        access_token: str,\n        tier_id: str,\n        project_id: Optional[str] = \"default-project\",\n        attempts: int = 10,\n        delay_ms: int = 5000,\n    ) -> Optional[str]:\n        \"\"\"\n        Onboard a managed project for the user, optionally retrying until completion.","sourceCodeStart":531,"sourceCodeEnd":567,"githubUrl":"https://github.com/xtekky/gpt4free/blob/973504e1770928ed5fb82f43da528f441ad9ddc3/g4f/Provider/needs_auth/GeminiCLI.py#L531-L567","documentation":"Project discovery loaded a response from the Code Assist load/onboard endpoint that contained no cloudaicompanionProject field, and the fallback call to onboard_managed_project also returned None (it gives up after its 10 attempts). Without a project ID the provider cannot route generate requests.","triggerScenarios":"discover_project_id succeeds at HTTP level but load_response.get('cloudaicompanionProject') is falsy, and onboard_managed_project finishes all attempts without a done operation, so the RuntimeError fires.","commonSituations":"Google account has no Cloud AI Companion / Code Assist project and auto-onboarding is blocked; region or workspace restrictions preventing managed-project creation; the free-tier onboarding endpoint changed.","solutions":["Set GEMINI_PROJECT_ID to a valid Google Cloud project that has Gemini Code Assist enabled, bypassing discovery","Manually trigger onboarding once in the Gemini CLI or Cloud Console with the same account, then retry","Re-login with an account that is eligible for Gemini Code Assist (see the 403 MissingAuthError path in onboard_managed_project)","Update g4f; discovery and onboarding payloads track the internal API"],"exampleFix":"// before\nawait provider.discover_project_id()  # raises\n\n// after\nos.environ['GEMINI_PROJECT_ID'] = 'my-gcp-project'  # skip discovery","handlingStrategy":"fallback","validationCode":"import os\n\nif not os.environ.get(\"GEMINI_PROJECT_ID\"):\n    # discovery will run and may fail; set it explicitly when you can\n    print(\"warning: GEMINI_PROJECT_ID unset; project discovery will be attempted\")","typeGuard":null,"tryCatchPattern":"try:\n    project = await provider.discover_project_id()\nexcept RuntimeError as e:\n    if \"No project information\" in str(e) or \"discover project ID\" in str(e):\n        project = os.environ.get(\"GEMINI_PROJECT_ID\")\n        if not project:\n            raise","preventionTips":["Set GEMINI_PROJECT_ID in production deployments so startup never depends on onboarding","Onboard once interactively (Gemini CLI) before automating","Watch for the preceding 403 eligibility error, which is the usual root cause"],"tags":["gemini","gcp","project","onboarding","configuration"],"backgroundTag":null,"analyzedSha":"973504e1770928ed5fb82f43da528f441ad9ddc3","analyzedAt":"2026-08-14T23:45:32.408Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}