{"record":{"id":"e7d6148918d8372a","repo":"JuliusBrussee/caveman","slug":"azure-bearer-credentials-are-unsupported-use-an-a","errorCode":null,"errorMessage":"azure bearer credentials are unsupported; use an API key","messagePattern":"azure bearer credentials are unsupported; use an API key","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"proxy/providers/adapter.go","lineNumber":508,"sourceCode":"\t\t\tout.Set(\"authorization\", \"Bearer \"+credential.Key)\n\t\t}\n\t\tcopyIfPresent(out, req.Header, \"x-vertex-ai-llm-request-type\")\n\t\tcopyIfPresent(out, req.Header, \"x-goog-user-project\")\n\tcase \"azure_openai\":\n\t\tif credential.Key != \"\" {\n\t\t\t// The standalone placeholder is a synthetic no-key marker used by\n\t\t\t// callers that explicitly allow env-backed API-key fallback. It is\n\t\t\t// not an Entra token and must not be forwarded as Authorization;\n\t\t\t// gateway fallback may replace it with the Azure api-key header.\n\t\t\tif credential.Scheme == \"bearer\" && credential.Key == \"no-key-required\" {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\t// Real bearer/JWT credentials remain fail-closed until an auth-kind is\n\t\t\t// persisted and mapped end-to-end. They must never be silently\n\t\t\t// relabeled as an api-key.\n\t\t\tfields := strings.Fields(strings.TrimSpace(credential.Key))\n\t\t\tif credential.Scheme == \"bearer\" || len(fields) > 1 && strings.EqualFold(fields[0], \"bearer\") || strings.HasPrefix(strings.TrimSpace(credential.Key), \"eyJ\") {\n\t\t\t\treturn nil, fmt.Errorf(\"azure bearer credentials are unsupported; use an API key\")\n\t\t\t}\n\t\t\tout.Set(\"api-key\", credential.Key)\n\t\t}\n\tdefault:\n\t\tif credential.Key != \"\" {\n\t\t\tout.Set(\"authorization\", \"Bearer \"+credential.Key)\n\t\t}\n\t}\n\treturn out, nil\n}\n\nfunc validGoogleQuotaProject(value string) bool {\n\tif value == \"\" || len(value) > 128 {\n\t\treturn false\n\t}\n\tfor _, r := range value {\n\t\tif r >= 'a' && r <= 'z' || r >= 'A' && r <= 'Z' || r >= '0' && r <= '9' || r == '-' || r == '.' || r == '_' || r == ':' {\n\t\t\tcontinue","sourceCodeStart":490,"sourceCodeEnd":526,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/5184b3d11ac6a1acb7d44b9bfaa31698157cff97/proxy/providers/adapter.go#L490-L526","documentation":"An Azure OpenAI credential arrived with bearer scheme but is not the synthetic no-key-required placeholder; the gateway only supports API-key auth for Azure, so the bearer token must not be forwarded as Authorization.","triggerScenarios":"Thrown at proxy/providers/adapter.go:504 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Configure an Azure API key credential instead of an Entra bearer token","If the placeholder marker was intended, verify the standalone env fallback path set the scheme correctly"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"5184b3d11ac6a1acb7d44b9bfaa31698157cff97","analyzedAt":"2026-08-18T03:14:35.516Z","contentChangedAt":"2026-08-18T03:14:35.516Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}