{"record":{"id":"9a0f5abd60ad2431","repo":"JuliusBrussee/caveman","slug":"compat-upstream-q-w","errorCode":null,"errorMessage":"compat upstream %q: %w","messagePattern":"compat upstream %q: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"proxy/internal/config/config.go","lineNumber":455,"sourceCode":"\t\t}\n\t}\n\treturn DefaultBedrockRegion\n}\n\n// BedrockBaseURL returns an explicit operator override or derives AWS's standard\n// Runtime endpoint from BedrockRegion. Callers never need to paste a raw URL for\n// the normal first-party path.\nfunc (c Config) BedrockBaseURL() string {\n\tif configured := c.BaseURL(\"bedrock\", \"\"); configured != \"\" {\n\t\treturn configured\n\t}\n\treturn fmt.Sprintf(\"https://bedrock-runtime.%s.amazonaws.com\", c.BedrockRegion())\n}\n\nfunc (c Config) validateCompat() error {\n\tfor name, upstream := range c.Compat {\n\t\tif err := openaicompat.ValidateName(name); err != nil {\n\t\t\treturn fmt.Errorf(\"compat upstream %q: %w\", name, err)\n\t\t}\n\t\tif strings.TrimSpace(upstream.BaseURL) == \"\" {\n\t\t\treturn fmt.Errorf(\"compat upstream %q: base_url is required\", name)\n\t\t}\n\t\tif err := openaicompat.ValidateBaseURL(upstream.BaseURL); err != nil {\n\t\t\treturn fmt.Errorf(\"compat upstream %q: base_url: %w\", name, err)\n\t\t}\n\t\tif err := openaicompat.ValidateForwardHeaders(upstream.ForwardHeaders); err != nil {\n\t\t\treturn fmt.Errorf(\"compat upstream %q: forward_headers: %w\", name, err)\n\t\t}\n\t\tif err := openaicompat.ValidateWireDialect(upstream.WireDialect); err != nil {\n\t\t\treturn fmt.Errorf(\"compat upstream %q: %w\", name, err)\n\t\t}\n\t}\n\treturn nil\n}\n\n// providerEnvKey maps a provider name to the BYOK environment variable that","sourceCodeStart":437,"sourceCodeEnd":473,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/3ee70a102609e550bd2e68004bf5990a9341c851/proxy/internal/config/config.go#L437-L473","documentation":"A compat upstream entry has a name that failed openaicompat.ValidateName, and validateCompat wraps that failure with this prefix. Names are keys of the compat map and must conform to the validator's rules (e.g. allowed characters/format) since they identify the upstream in routing and config.","triggerScenarios":"Defining a compat upstream in config with a key that openaicompat.ValidateName rejects (bad characters, invalid format, wrong casing/length per that validator) and calling Load.","commonSituations":"Renaming upstreams with spaces or slashes in the key; uppercase or special-character keys copied from vendor docs; YAML/JSON keys accidentally including quotes or trailing whitespace.","solutions":["Rename the compat upstream key to satisfy openaicompat.ValidateName (check its rules for allowed characters/format).","Use a simple lowercase alphanumeric/hyphen name (e.g. \"my-openai\") and retry Load.","Read the wrapped %w error in the message to see the exact rule violated."],"exampleFix":"// before\n[compat.\"My OpenAI!\"]\nbase_url = \"https://api.example.com/v1\"\n// after\n[compat.\"my-openai\"]\nbase_url = \"https://api.example.com/v1\"","handlingStrategy":"validation","validationCode":"if err := openaicompat.ValidateName(name); err != nil {\n    return fmt.Errorf(\"compat upstream %q: %w\", name, err)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use lowercase alphanumeric/hyphen names for compat upstream keys.","Avoid spaces and punctuation in config keys.","Run config validation in CI to catch bad names before deploy."],"tags":["config","compat","validation"],"backgroundTag":"invalid-identifier-format","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"}