{"record":{"id":"487c21ca5b20b72f","repo":"JuliusBrussee/caveman","slug":"compat-upstream-name-q-is-reserved","errorCode":null,"errorMessage":"compat upstream name %q is reserved","messagePattern":"compat upstream name %q is reserved","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"proxy/providers/openaicompat/openaicompat.go","lineNumber":288,"sourceCode":"\t}\n\tprefix := \"/compat/\" + name\n\treturn namedAdapter{\n\t\tBase: providers.Base{\n\t\t\tProvider: \"openai_compatible\",\n\t\t\tBaseURL:  baseURL,\n\t\t\tRoutes:   []string{prefix + \"/\"},\n\t\t},\n\t\tprefix: prefix,\n\t}, nil\n}\n\nfunc ValidateName(name string) error {\n\tif !validName.MatchString(name) {\n\t\treturn fmt.Errorf(\"compat upstream name %q must match [a-z0-9][a-z0-9._-]{0,63}\", name)\n\t}\n\tswitch name {\n\tcase \"stub\", \"openai-compatible\":\n\t\treturn fmt.Errorf(\"compat upstream name %q is reserved\", name)\n\tdefault:\n\t\treturn nil\n\t}\n}\n\nfunc ValidateBaseURL(raw string) error {\n\t_, err := parseBaseURL(raw, \"compat\")\n\treturn err\n}\n\n// ResolveUpstreamURL intentionally ignores RouteContext.BaseURL. Named mounts\n// are configured as independent static upstreams (`compat:` in standalone or\n// CAVE_COMPAT_UPSTREAMS in managed mode); applying the generic project\n// openai_compatible override here would collapse every named route onto one\n// target. The default /compat/ adapter is the route that honors BaseURL.\nfunc (a namedAdapter) ResolveUpstreamURL(_ context.Context, req *http.Request, _ providers.RouteContext) (*url.URL, error) {\n\tif req == nil || req.URL == nil {\n\t\treturn nil, fmt.Errorf(\"compat request URL is missing\")","sourceCodeStart":270,"sourceCodeEnd":306,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/15581d14007fd01fb3f132016741962f34936ca2/proxy/providers/openaicompat/openaicompat.go#L270-L306","documentation":"ValidateName reserves the names \"stub\" and \"openai-compatible\" because they collide with built-in route identifiers. Configuring a compat upstream under one of these names is rejected even though the name itself is well-formed.","triggerScenarios":"Thrown at proxy/providers/openaicompat/openaicompat.go:208 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Choose a different upstream name that is not stub or openai-compatible","Update the config that defines the compat upstream"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"15581d14007fd01fb3f132016741962f34936ca2","analyzedAt":"2026-08-18T03:14:35.516Z","contentChangedAt":"2026-08-18T03:14:35.516Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}