xtekky/gpt4free · error · RuntimeError
No project information found in API response.
Error message
No project information found in API response.
What it means
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.
Source
Thrown at g4f/Provider/needs_auth/GeminiCLI.py:549
try:
load_response = await self.auth_manager.call_endpoint(
"loadCodeAssist",
{
"cloudaicompanionProject": "default-project",
"metadata": {"duetProject": "default-project"},
},
)
project = load_response.get("cloudaicompanionProject")
if project:
self._project_id = project
return project
project = await self.onboard_managed_project(
access_token=self.auth_manager.get_access_token(), tier_id="free-tier"
)
if project:
self._project_id = project
return project
raise RuntimeError("No project information found in API response.")
except MissingAuthError:
raise
except Exception as e:
debug.error(f"Failed to discover project ID: {e}")
raise RuntimeError(
"Could not discover project ID. Ensure authentication or set GEMINI_PROJECT_ID."
)
async def onboard_managed_project(
self,
access_token: str,
tier_id: str,
project_id: Optional[str] = "default-project",
attempts: int = 10,
delay_ms: int = 5000,
) -> Optional[str]:
"""
Onboard a managed project for the user, optionally retrying until completion.View on GitHub (pinned to 973504e177)
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
Example fix
// before await provider.discover_project_id() # raises // after os.environ['GEMINI_PROJECT_ID'] = 'my-gcp-project' # skip discovery
Defensive patterns
Strategy: fallback
Validate before calling
import os
if not os.environ.get("GEMINI_PROJECT_ID"):
# discovery will run and may fail; set it explicitly when you can
print("warning: GEMINI_PROJECT_ID unset; project discovery will be attempted") Try / catch
try:
project = await provider.discover_project_id()
except RuntimeError as e:
if "No project information" in str(e) or "discover project ID" in str(e):
project = os.environ.get("GEMINI_PROJECT_ID")
if not project:
raise Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Could not discover project ID. Ensure authentication or set
- Project ID discovery failed - set ANTIGRAVITY_PROJECT_ID in
- Invalid thinking mode: {think_value!r}
- Thinking mode must be an integer between 0 and 4
- No refresh token found in GCP_SERVICE_ACCOUNT.
AI-assisted analysis of xtekky/gpt4free@973504e177 (2026-08-14).
Data as JSON: /api/errors/5a3a96c49e9c2224.
Report an issue: GitHub.