Random Gemini 400 errors on Cloudflare Workers traced to HKG datacenter routing
sujingshen · x · 2026-10-12
A developer's writeup on random "User location is not supported" 400 errors when calling Gemini from Cloudflare Workers.
- Root cause: Gemini checks the egress IP of the machine making the request—the datacenter the Worker runs in—not the API key's region or the end user's location. Mainland China and Hong Kong are unsupported; requests routed to HKG fail.
- Why intermittent: Cloudflare routing varies. A Korean developer alternated between NRT (works) and HKG (fails); a Melbourne user hit a Worker 4,600 miles away in HKG; similar reports from the Philippines and Vietnam.
- Pitfall: Cloudflare AI Gateway does not fix it—same region error.
- Diagnosis: check the datacenter code at the end of the cf-ray response header (e.g. -HKG).
More from Infra
- SpaceX and Nvidia unveil orbital AI supercomputer Kyber Galaxy: 72 chips, first launch 2027 — r0ck3t23 · 2026-12-02
- SpaceX's orbital data centers face a looming space debris threat — krishnan · 2026-12-02
- Nearly a third of WordPress sites run PHP with no security fixes; half by January 1 — JeremyCMorgan · 2026-12-02
- Data center water panic traced to botched numbers: key figure off by 1,000x — ATTlKA · 2026-12-02
- NVIDIA and SpaceX unveil Kyber Galaxy, a space-based AI supercomputer with 72 Rubin GPUs — elonmusk · 2026-12-02
- Export controls may widen US-China AI gap by only 2-3 months, argues analyst — kevinnbass · 2026-12-02