{"record":{"id":"865e8469c1bfc964","repo":"xtekky/gpt4free","slug":"all-antigravity-endpoints-failed-last-error-las","errorCode":null,"errorMessage":"All Antigravity endpoints failed. Last error: {last_error}","messagePattern":"All Antigravity endpoints failed\\. Last error: (.+?)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"g4f/Provider/needs_auth/Antigravity.py","lineNumber":568,"sourceCode":"                                method,\n                                body,\n                                is_retry=True,\n                                use_auth_headers=use_auth_headers,\n                            )\n                        elif resp.ok:\n                            self._working_base_url = base_url  # Cache working URL\n                            return await resp.json()\n                        else:\n                            last_error = f\"HTTP {resp.status}: {await resp.text()}\"\n                            debug.log(\n                                f\"Antigravity endpoint {base_url} returned {resp.status}\"\n                            )\n            except Exception as e:\n                last_error = str(e)\n                debug.log(f\"Antigravity endpoint {base_url} failed: {e}\")\n                continue\n\n        raise RuntimeError(\n            f\"All Antigravity endpoints failed. Last error: {last_error}\"\n        )\n\n    def get_working_base_url(self) -> str:\n        \"\"\"Get the cached working base URL or default to first in list.\"\"\"\n        return self._working_base_url or BASE_URLS[0]\n\n    @classmethod\n    def build_authorization_url(cls, project_id: str = \"\") -> Tuple[str, str, str]:\n        \"\"\"\n        Build OAuth authorization URL with PKCE.\n\n        Returns:\n            Tuple of (authorization_url, verifier, state)\n        \"\"\"\n        verifier, challenge = generate_pkce_pair()\n        state = encode_oauth_state(verifier, project_id)\n","sourceCodeStart":550,"sourceCodeEnd":586,"githubUrl":"https://github.com/xtekky/gpt4free/blob/973504e1770928ed5fb82f43da528f441ad9ddc3/g4f/Provider/needs_auth/Antigravity.py#L550-L586","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// caller-side retry with backoff\nimport asyncio\nfrom g4f.Provider.needs_auth import Antigravity\n\nasync def call_with_retry():\n    for attempt in range(3):\n        try:\n            return await Antigravity.auth_manager.call_endpoint(method=\"loadCodeAssist\", body={...})\n        except RuntimeError as e:\n            if attempt == 2 or \"HTTP 4\" in str(e):\n                raise\n            await asyncio.sleep(2 ** attempt)","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    result = await antigravity.call_endpoint(...)\nexcept RuntimeError as e:\n    if \"All Antigravity endpoints failed\" in str(e):\n        if \"HTTP 401\" in str(e) or \"HTTP 403\" in str(e):\n            raise  # auth problem: do not retry\n        await asyncio.sleep(backoff)  # 429/5xx/network: retry","preventionTips":["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"],"tags":["network","antigravity","retry","upstream"],"backgroundTag":null,"analyzedSha":"973504e1770928ed5fb82f43da528f441ad9ddc3","analyzedAt":"2026-08-14T23:45:32.408Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}