{"record":{"id":"805ed3ae95796981","repo":"JuliusBrussee/caveman","slug":"bedrock-configured-endpoint-kind-q-does-not-allow","errorCode":null,"errorMessage":"bedrock configured endpoint kind %q does not allow request kind %q","messagePattern":"bedrock configured endpoint kind %q does not allow request kind %q","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"proxy/providers/bedrock/routing.go","lineNumber":163,"sourceCode":"// quotas, features, stream wire, and AWS invocation-logging support differ from\n// Runtime. Both surfaces remain provider=bedrock in telemetry.\nfunc (a Adapter) ResolveUpstreamURL(ctx context.Context, req *http.Request, route providers.RouteContext) (*url.URL, error) {\n\tbaseURL := a.BaseURL\n\tif route.BaseURL != \"\" {\n\t\tbaseURL = route.BaseURL\n\t}\n\tbase, err := url.Parse(baseURL)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"bedrock base url invalid: %w\", err)\n\t}\n\tregion, err := resolveRegion(req, base)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tkind := endpointKindForPath(req.URL.Path)\n\tif configuredKind := strings.ToLower(strings.TrimSpace(route.EndpointKind)); configuredKind != \"\" && configuredKind != kind {\n\t\treturn nil, fmt.Errorf(\"bedrock configured endpoint kind %q does not allow request kind %q\", configuredKind, kind)\n\t}\n\tswitch kind {\n\tcase endpointRuntime:\n\t\tif !RegionAllowed(region) {\n\t\t\treturn nil, fmt.Errorf(\"bedrock region %q is not on the allowlist\", region)\n\t\t}\n\t\tmodelID, action := parseModelPath(req.URL.Path)\n\t\tif modelID == \"\" || action == \"\" {\n\t\t\treturn nil, fmt.Errorf(\"bedrock request path %q does not name a model and action\", req.URL.Path)\n\t\t}\n\t\tif !actionAllowed(action) {\n\t\t\treturn nil, fmt.Errorf(\"bedrock action %q is not allowed\", action)\n\t\t}\n\t\tif !modelAllowed(modelID) {\n\t\t\treturn nil, fmt.Errorf(\"bedrock model %q is not on the allowlist\", modelID)\n\t\t}\n\t\tbase.Path = strings.TrimRight(base.Path, \"/\") + strings.TrimPrefix(req.URL.Path, \"/bedrock\")\n\tcase endpointMantle:","sourceCodeStart":145,"sourceCodeEnd":181,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/3ee70a102609e550bd2e68004bf5990a9341c851/proxy/providers/bedrock/routing.go#L145-L181","documentation":"A route can pin an endpoint kind (\"runtime\" for /bedrock/model/... paths, \"mantle\" for /bedrock/anthropic/... paths) via route.EndpointKind. When the configured kind does not match the kind derived from the request path, the request is rejected so a route can never send traffic to an endpoint type it was not configured for.","triggerScenarios":"A route configured with endpoint kind \"mantle\" receiving a /bedrock/model/{modelId}/{action} request, or a route configured with \"runtime\" receiving a /bedrock/anthropic/v1/messages request.","commonSituations":"Operator switched a route between Bedrock Runtime and Mantle without updating endpoint_kind; a client SDK sends the wrong path family for the route; case/whitespace mismatches in the configured kind are tolerated (trimmed/lowercased), so this is a genuine kind mismatch.","solutions":["Update the route's endpoint_kind to match the request path family (\"runtime\" for /bedrock/model/..., \"mantle\" for /bedrock/anthropic/...).","Send the request to the path family the route is pinned to.","If both kinds are needed, create two routes with separate endpoint_kind values."],"exampleFix":"// before (caveman.yaml)\nendpoint_kind: \"mantle\"\n// request: POST /bedrock/model/anthropic.claude-3-5-sonnet/invoke\n// after\nendpoint_kind: \"runtime\"","handlingStrategy":"validation","validationCode":"func kindMatches(path, configuredKind string) bool {\n\tconfiguredKind = strings.ToLower(strings.TrimSpace(configuredKind))\n\tif configuredKind == \"\" {\n\t\treturn true\n\t}\n\tswitch {\n\tcase strings.HasPrefix(path, \"/bedrock/model/\"):\n\t\treturn configuredKind == \"runtime\"\n\tcase strings.HasPrefix(path, \"/bedrock/anthropic/\"):\n\t\treturn configuredKind == \"mantle\"\n\t}\n\treturn false\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep endpoint_kind and the client's path family in one place — derive one from the other.","When migrating a route between Runtime and Mantle, update both endpoint_kind and client base paths together.","Document per-route which URL prefix clients must use."],"tags":["bedrock","aws","routing","config","endpoint-kind"],"backgroundTag":"conflicting-config-options","analyzedSha":"3ee70a102609e550bd2e68004bf5990a9341c851","analyzedAt":"2026-09-20T15:53:39.229Z","contentChangedAt":"2026-09-20T15:53:39.229Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}