xtekky/gpt4free · error · RuntimeError
All Antigravity endpoints failed. Last error: {last_error}
Error message
All Antigravity endpoints failed. Last error: {last_error} What it means
The provider iterates its BASE_URLS list, trying each Antigravity API endpoint in turn; this error means every endpoint raised an exception or returned a non-200 status. The last error encountered is embedded, so the message tells you whether the final failure was a network exception or an HTTP status code.
Source
Thrown at g4f/Provider/needs_auth/Antigravity.py:568
method,
body,
is_retry=True,
use_auth_headers=use_auth_headers,
)
elif resp.ok:
self._working_base_url = base_url # Cache working URL
return await resp.json()
else:
last_error = f"HTTP {resp.status}: {await resp.text()}"
debug.log(
f"Antigravity endpoint {base_url} returned {resp.status}"
)
except Exception as e:
last_error = str(e)
debug.log(f"Antigravity endpoint {base_url} failed: {e}")
continue
raise RuntimeError(
f"All Antigravity endpoints failed. Last error: {last_error}"
)
def get_working_base_url(self) -> str:
"""Get the cached working base URL or default to first in list."""
return self._working_base_url or BASE_URLS[0]
@classmethod
def build_authorization_url(cls, project_id: str = "") -> Tuple[str, str, str]:
"""
Build OAuth authorization URL with PKCE.
Returns:
Tuple of (authorization_url, verifier, state)
"""
verifier, challenge = generate_pkce_pair()
state = encode_oauth_state(verifier, project_id)
View on GitHub (pinned to 973504e177)
Solutions
- Read last_error in the message: 'HTTP 401/403' -> re-authenticate (token expired or revoked); 'HTTP 429' -> back off and retry later; connection/DNS errors -> check network and proxy.
- Retry after a delay; transient upstream failures on all endpoints usually resolve.
- Re-run the login flow to mint a fresh access token.
- Check Google Cloud status page for Antigravity/Gemini Code Assist outages.
Example fix
// caller-side retry with backoff
import asyncio
from g4f.Provider.needs_auth import Antigravity
async def call_with_retry():
for attempt in range(3):
try:
return await Antigravity.auth_manager.call_endpoint(method="loadCodeAssist", body={...})
except RuntimeError as e:
if attempt == 2 or "HTTP 4" in str(e):
raise
await asyncio.sleep(2 ** attempt) Defensive patterns
Strategy: retry
Try / catch
try:
result = await antigravity.call_endpoint(...)
except RuntimeError as e:
if "All Antigravity endpoints failed" in str(e):
if "HTTP 401" in str(e) or "HTTP 403" in str(e):
raise # auth problem: do not retry
await asyncio.sleep(backoff) # 429/5xx/network: retry Prevention
- Wrap call_endpoint in exponential-backoff retry for 5xx/429 last_error values
- Keep the access token fresh so 401s do not consume endpoint attempts
- Monitor Google Cloud status when multiple mirrors fail simultaneously
When it happens
Trigger: call_endpoint() loops over BASE_URLS; each attempt either throws (DNS failure, timeout, TLS error) or returns non-200 (401 unauthorized, 403, 429, 5xx). After the loop, RuntimeError with last_error is raised. A 429 or 5xx on all mirrors means upstream outage/quota exhaustion; a 401 on all means the access token is bad.
Common situations: Google Cloud/Antigravity service outage or regional blocking; rate limiting after heavy use; expired access token combined with a failed refresh; local network blocking googleapis domains.
Related errors
- Token refresh failed: {text}
- Could not discover project ID. Ensure authentication or set
- Operation failed after {retries} attempts.
- download interrupted: %w
- CDP module is required for Cloudflare provider. Please ensur
AI-assisted analysis of xtekky/gpt4free@973504e177 (2026-08-14).
Data as JSON: /api/errors/865e8469c1bfc964.
Report an issue: GitHub.