JuliusBrussee/caveman · error
vertex request path does not name a publisher, model, and…
Error message
vertex request path %q does not name a publisher, model, and method
What it means
The Vertex adapter's ResolveUpstreamURL parses the request path expecting the native aiplatform shape /v1/projects/{p}/locations/{l}/publishers/{pub}/models/{model}:{method} (routing.go:36-38). parsePredictPath extracts publisher, model, and method; if any of the three is empty the path is not a valid predict-style route and the request is rejected. This is a fail-closed guard: the adapter cannot resolve a correct upstream URL for an unrecognized path shape.
Solutions
- Send the request to the full predict-shaped path: /vertex/v1/projects/{p}/locations/{l}/publishers/{pub}/models/{model}:{method}.
- Verify the method suffix ':generateContent', ':streamGenerateContent', ':rawPredict', ':streamRawPredict', or ':countTokens' is present after the model id.
- Check the path uses the exact segment names 'publishers' and 'models' (plural) with a non-empty segment after each.
- If using an Anthropic SDK on Vertex, the fixed literal path .../models/count-tokens:rawPredict is recognized and allowed.
Example fix
// before POST /vertex/v1/projects/my-proj/locations/us-central1/models/gemini-2.5-pro // after POST /vertex/v1/projects/my-proj/locations/us-central1/publishers/google/models/gemini-2.5-pro:generateContent
Defensive patterns
Strategy: validation
Validate before calling
publisher, model, method := parsePredictPath(req.URL.Path)
if publisher == "" || model == "" || method == "" {
return fmt.Errorf("path %q must look like /v1/projects/{p}/locations/{l}/publishers/{pub}/models/{model}:{method}", req.URL.Path)
} Type guard
func isPredictShapedPath(path string) bool {
p, m, meth := parsePredictPath(path)
return p != "" && m != "" && meth != ""
} Try / catch
u, err := adapter.ResolveUpstreamURL(ctx, req, route)
if err != nil {
if strings.Contains(err.Error(), "does not name a publisher") {
return httpError(400, "check the Vertex path: needs publishers/{pub}/models/{model}:{method}")
}
return err
} Prevention
- Always generate Vertex paths from an SDK or template rather than hand-writing them.
- Remember the ':method' suffix is mandatory on the model segment.
- Use exact segment names: 'publishers' and 'models' (plural).
- Log the full request path when debugging 4xx/404s from the proxy.
When it happens
Trigger: POST to a /vertex/... route whose path lacks the publishers/, models/, or a 'model:method' segment — e.g. '/vertex/v1/projects/p/locations/us-east1' (no publishers/models), '/vertex/v1/.../models/gemini-2.5-pro' without ':generateContent', or a mistyped path like 'publisher' instead of 'publishers'.
Common situations: Clients written against a different Vertex surface (e.g. raw endpoints or matching-engine routes), SDKs that build non-predict paths (fine-tuning, index endpoints), typos in a hand-rolled request, or an older SDK that omits the ':method' suffix.
Understand the failure class
Background: "Invalid URL" errors: why new URL(), URI.parse, and reqwest::Url reject your string — missing scheme, whitespace, and bad path format — this error's family across 39 libraries.
Related errors
- vertex method is not allowed for publisher
- compat route does not match default /compat/ mount
- compat route does not match prefix
- vertex base url invalid
- vertex endpoint host
AI-assisted analysis of JuliusBrussee/caveman@3ee70a1026 (2026-09-20).
Data as JSON: /api/errors/90b70c1a207b0465.
Report an issue: GitHub.
Appendix: source
Thrown at proxy/providers/vertex/routing.go:38
// defaultModelPrefixes is the built-in model-id allowlist, matched as prefixes
// so versioned ids (gemini-2.5-pro, claude-sonnet-4-5@20250929) are covered.
// Operators override it with CAVE_VERTEX_MODEL_ALLOWLIST.
var defaultModelPrefixes = []string{"gemini-", "claude-"}
// ResolveUpstreamURL validates the Vertex request shape (publisher + model on
// the allowlist), enforces SSRF/host constraints against the aiplatform
// endpoint, and resolves the upstream URL. The /vertex prefix is stripped so the
// upstream path is the native aiplatform path
// (/v1/projects/{p}/locations/{l}/publishers/{pub}/models/{model}:{method}). The
// non-authentication query bytes (e.g. ?alt=sse) are preserved unchanged.
func (a Adapter) ResolveUpstreamURL(ctx context.Context, req *http.Request, route providers.RouteContext) (*url.URL, error) {
if _, err := providers.GoogleRequestAPIKey(req); err != nil {
return nil, err
}
publisher, model, method := parsePredictPath(req.URL.Path)
if publisher == "" || model == "" || method == "" {
return nil, fmt.Errorf("vertex request path %q does not name a publisher, model, and method", req.URL.Path)
}
if !methodAllowed(publisher, method) {
return nil, fmt.Errorf("vertex method %q is not allowed for publisher %q", method, publisher)
}
if !publisherAllowed(publisher) {
return nil, fmt.Errorf("vertex publisher %q is not on the allowlist", publisher)
}
if !modelAllowed(model) && !anthropicCountTokensPath(publisher, model, method) {
return nil, fmt.Errorf("vertex model %q is not on the allowlist", model)
}
baseURL := a.BaseURL
if route.BaseURL != "" {
baseURL = route.BaseURL
}
base, err := url.Parse(baseURL)
if err != nil {
return nil, fmt.Errorf("vertex base url invalid: %w", err)View on GitHub (pinned to 3ee70a1026)