{"record":{"id":"fb7efcd57f210703","repo":"JuliusBrussee/caveman","slug":"azure-request-missing-api-version","errorCode":null,"errorMessage":"azure request missing api-version","messagePattern":"azure request missing api-version","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"proxy/providers/azureopenai/azure_routing.go","lineNumber":61,"sourceCode":"\t\t}\n\t\tif len(versions) == 1 && versions[0] != \"v1\" && versions[0] != \"preview\" {\n\t\t\treturn fmt.Errorf(\"azure Foundry api-version %q is not supported\", versions[0])\n\t\t}\n\t\treturn nil\n\t}\n\tif !legacyChatCompletionsRoute(u.Path) {\n\t\treturn fmt.Errorf(\"azure legacy inference path %q is not supported\", u.Path)\n\t}\n\tversions := u.Query()[\"api-version\"]\n\tif len(versions) > 1 {\n\t\treturn fmt.Errorf(\"azure request has duplicate api-version values\")\n\t}\n\tversion := \"\"\n\tif len(versions) == 1 {\n\t\tversion = versions[0]\n\t}\n\tif version == \"\" {\n\t\treturn fmt.Errorf(\"azure request missing api-version\")\n\t}\n\tif !apiVersionAllowed(version) {\n\t\treturn fmt.Errorf(\"azure api-version %q is not on the allowlist\", version)\n\t}\n\treturn nil\n}\n\nfunc foundryV1InferenceRoute(path string) bool {\n\tpath = strings.TrimPrefix(path, \"/azure\")\n\tswitch path {\n\tcase \"/openai/v1/chat/completions\", \"/openai/v1/responses\":\n\t\treturn true\n\tdefault:\n\t\treturn false\n\t}\n}\n\nfunc legacyChatCompletionsRoute(path string) bool {","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/3ee70a102609e550bd2e68004bf5990a9341c851/proxy/providers/azureopenai/azure_routing.go#L43-L79","documentation":"On the legacy deployment chat-completions route, an api-version query parameter is mandatory. The adapter requires exactly one api-version and rejects requests that omit it before resolving the upstream URL.","triggerScenarios":"A request to /azure/openai/deployments/{deployment}/chat/completions with no api-version query parameter at all.","commonSituations":"Switching a client from the Foundry v1 route (where api-version is optional) to the legacy deployment route without adding the parameter; SDKs that omit api-version expecting the proxy to inject it; hand-written curl commands.","solutions":["Add ?api-version=<allowed-version> to the legacy deployment URL, e.g. api-version=2024-10-21.","Configure the client/SDK to always append api-version for Azure deployment-style endpoints.","Alternatively switch to the Foundry v1 route, where api-version is not required."],"exampleFix":"// before\nGET /azure/openai/deployments/gpt-4o/chat/completions\n// after\nGET /azure/openai/deployments/gpt-4o/chat/completions?api-version=2024-10-21","handlingStrategy":"validation","validationCode":"func legacyRouteHasVersion(rawURL string) bool {\n\tu, err := url.Parse(rawURL)\n\tif err != nil {\n\t\treturn false\n\t}\n\tp := strings.TrimPrefix(u.Path, \"/azure\")\n\tparts := strings.Split(strings.Trim(p, \"/\"), \"/\")\n\tisLegacy := len(parts) == 5 && parts[1] == \"deployments\" && parts[3] == \"chat\" && parts[4] == \"completions\"\n\treturn !isLegacy || len(u.Query()[\"api-version\"]) == 1\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always include api-version on deployment-style Azure OpenAI URLs.","Configure the SDK's Azure client with an explicit APIVersion field rather than relying on defaults.","Prefer the Foundry v1 route when you do not want to manage date-style versions."],"tags":["azure","openai","api-version","missing-parameter","validation"],"backgroundTag":"missing-required-argument","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"}