-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Description
Describe the bug
When GCP_LOCATION=global, the streaming fallback in post_stream produces an invalid URL. The global host (https://aiplatform.googleapis.com) gets paired with a regional path (locations/us-east5), and GCP returns 500 for that combination.
This happens because build_vertex_url (line 72-75) does host.replace("global", "us-east5"), but "global" does not appear in the global host string, so the replace is a no-op. The correct logic already exists in build_host_url (line 233-237) but is not used by the fallback path.
The fallback triggers intermittently when GCP's global endpoint routes to a region where the model is unavailable (400). It was always broken for global, but only became visible recently as GCP started routing to regions like us-east4 where Claude is unavailable.
To Reproduce
- Set
GCP_LOCATION=global - Use any Claude model (e.g.,
claude-haiku-4-5@20251001) - Wait for GCP's global endpoint to route to a region where the model returns 400
- The fallback fires and produces a 500
Expected behavior
build_vertex_url should reuse build_host_url to reconstruct the host when switching locations, instead of host.replace:
let host_url = if configured_location == target_location {
host.to_string()
} else {
Self::build_host_url(target_location)
};Please provide the following information
- OS & Arch: macOS ARM64
- Interface: CLI
- Version: v1.28.0
- Extensions enabled: developer, code-analyze, context7, brave_search, aptu
- Provider & Model: gcp_vertex_ai, claude-haiku-4-5@20251001 / claude-sonnet-4-6@default
Additional context
- Related: Fix GCP Vertex AI global endpoint support for Gemini 3 models #6187, feat(vertexai): Add streaming support #6409
- Workaround:
GCP_LOCATION=us-east5 - The broken code path:
post_stream(line 383) ->post_stream_with_location->build_vertex_url(line 72-75)