✕ [API Error: User location is not supported for the API use. (Status: FAILED_PRECONDITION)] in the US #1663
Replies: 2 comments 4 replies
|
Can you open a bug report here? https://github.com/google-gemini/gemini-cli/issues/new?template=bug_report.yml Providing more information in a bug report will help the team resolve your issue faster. Thanks! |
|
FIXED: "FAILED_PRECONDITION (code 400): User location is not supported" in Google Antigravity / Gemini Subagents If you are running Google Antigravity IDE/CLI or complex multi-agent frameworks (such as AutoClaw/OpenClaw setups) from unsupported regions (e.g., Iran or other restricted territories), you have probably encountered the notorious geo-blocking error: FAILED_PRECONDITION (code 400): User location is not supported for the API use While standard approaches like Smart DNS or system-wide VPNs are either too slow or prone to sudden stream drops (which instantly crash long-running subagents), there is a highly stable, production-grade architectural workaround to bypass this restriction entirely. ============================================================================== THE ROOT CAUSE OF THE FAILURE============================================================================== Google's API Gateway does not just check your DNS exit node. It performs strict geo-IP inspection on the handshake headers, transport layers, and active streams of direct connections to generativelanguage.googleapis.com. When Antigravity spawns heavy subagent loops (e.g., Orders Auditor, Financial Auditor, etc.), any tiny network jitter or DNS leak instantly exposes your real origin, throwing a Code 400 error and killing the entire execution stack. ==============================================================================2. THE SOLUTION: REVERSE PROXY TUNNELING VIA OMNI ROUTE + OPENCODE Instead of routing your entire operating system through a VPN, you can isolate and intercept the specific model traffic. By configuring Antigravity to run through Omni Route (acting as a local/private reverse-proxy gateway) and mapping the upstream model calls through the OpenCode network, you bypass Google's gateway checks. Conceptual Data Flow:Antigravity Client -> Omni Route (Local Proxy) -> OpenCode Middleware -> Clean Cloud VPS Node -> Google API (Allowed) This strips away geographical metadata, normalizes headers, and maintains a highly persistent keep-alive stream connection. ==============================================================================3. STEP-BY-STEP IMPLEMENTATION GUIDE Step 1: Spin up your Omni Route ProxyYou need a local gateway/reverse proxy (like omni.local running on your local loopback, typically porting to your VPS exit point). Ensure your proxy configuration is active and accessible: Local address: http://127.0.0.1:8080/ (or http://omni.local/v1 depending on your custom network host configuration). Step 2: Re-route Antigravity & Agent Model ProfilesModify your orchestrator or global configurations (openclaw.json, settings.json, or your local agent configurations) to redirect the Gemini endpoint. Change the direct provider settings to use the custom local Omni route instead of Google's direct URL: {"provider": "omni","model": "antigravity/claude-sonnet-5","alias": "antigravity/claude-sonnet-5 | code+general | normal","apiKey": "YOUR_ENCRYPTED_OR_DIRECT_OMNI_KEY","baseUrl": "http://omni.local/v1","api": "openai-completions","contextWindow": 200000,"maxTokens": 32000} Step 3: Leverage OpenCode for Model ResolutionIn your agent routing configurations, enforce the fallback and delegation chains to resolve models via OpenCode wrapper agents. This prevents direct clients from establishing un-proxied sessions to Google endpoints. For instance, map your workspace fallbacks inside your watcher or runner script: CODE_CHAIN = {"primary": "omni__custom_xxx/antigravity/claude-sonnet-4-6","fallbacks": ["omni__xxx/cgpt-web/gpt-5.5"]} ==============================================================================4. WHY THIS IS VASTLY SUPERIOR TO VPNS / DNS CHANGERS Unrivaled Stability: Subagents run long, complex background tasks. This setup preserves HTTP/2 and SSE (Server-Sent Events) streams without losing connection. Native Performance: It only proxies LLM API payloads; your local file reads, test runner execution, and dependency installs remain native-speed. No Auth/OAuth Invalidations: Your Google accounts/tokens will not get flagged for constant geographical hopping because the proxy maintains a clean, singular exit node. Give this architecture a shot! It successfully restored all heavy concurrent auditor subagents with zero location errors.i am aref alapour and this my page mr.fsdeveloper |
Uh oh!
There was an error while loading. Please reload this page.
Describe the bug
✕ [API Error: User location is not supported for the API use. (Status: FAILED_PRECONDITION)]Additional context
I'm based out fo the US (Boston), but was previously traveling abroad and using a VPN - is there a way to reset my settings now that I am back in the US so I can use this?
Diagnostic Information
All reactions