{"record":{"id":"0d74010db7413804","repo":"continuedev/continue","slug":"env-apiversion-is-a-required-configuration-prope","errorCode":null,"errorMessage":"`env.apiVersion` is a required configuration property for Azure OpenAI","messagePattern":"`env\\.apiVersion` is a required configuration property for Azure OpenAI","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/openai-adapters/src/apis/Azure.ts","lineNumber":62,"sourceCode":"    // Copy search params to separate object for OpenAI\n    const queryParams: Record<string, string> = {};\n    for (const [key, value] of url.searchParams.entries()) {\n      queryParams[key] = value;\n    }\n\n    url.pathname = url.pathname.replace(/\\/$/, \"\"); // Remove trailing slash if present\n    url.search = \"\"; // Clear original search params\n\n    // Default is `azure-openai` in docs, but previously was `azure`\n    if (this._isAzureOpenAI(config.env?.apiType)) {\n      if (!config.env?.deployment) {\n        throw new Error(\n          \"`env.deployment` is a required configuration property for Azure OpenAI\",\n        );\n      }\n\n      if (!config.env?.apiVersion) {\n        throw new Error(\n          \"`env.apiVersion` is a required configuration property for Azure OpenAI\",\n        );\n      }\n\n      const basePathname = `openai/deployments/${config.env.deployment}`;\n\n      url.pathname =\n        url.pathname === \"/\" ? basePathname : `${url.pathname}/${basePathname}`;\n\n      queryParams[\"api-version\"] = config.env.apiVersion;\n    }\n\n    return {\n      baseURL: url.toString(),\n      defaultQuery: queryParams,\n    };\n  }\n","sourceCodeStart":44,"sourceCodeEnd":80,"githubUrl":"https://github.com/continuedev/continue/blob/5522c6f44ca0ac3528b37244818fbfa39b5af470/packages/openai-adapters/src/apis/Azure.ts#L44-L80","documentation":"For Azure OpenAI's native API (apiType 'azure-openai'), every request URL must include the apiVersion query parameter, which Azure uses to select the API surface. The adapter validates this in _getAzureBaseURL and throws before sending a request that Azure would reject with a 400 ('api-version query parameter is required').","triggerScenarios":"Configuring apiType: 'azure-openai' with a deployment but no env.apiVersion; the defaultQuery getter calls _getAzureBaseURL which enforces the requirement.","commonSituations":"Porting code from the openai npm SDK where apiVersion is passed per-request rather than in config; forgetting that Azure requires the dated version string (e.g. '2024-02-01'); config files trimmed down to apiKey only.","solutions":["Add env.apiVersion with a valid Azure OpenAI GA version, e.g. '2024-02-01'","Use the latest preview/GA version matching your resource's region and features if the GA version errors","If on the azure-api-key gateway mode, switch apiType so apiVersion is not required"],"exampleFix":"// before\n{ provider: 'azure', apiType: 'azure-openai', apiKey: '...', deployment: 'my-deploy' }\n\n// after\n{ provider: 'azure', apiType: 'azure-openai', apiKey: '...', deployment: 'my-deploy', apiVersion: '2024-02-01' }","handlingStrategy":"validation","validationCode":"const AZURE_API_VERSION = '2024-02-01';\nif (config.env?.apiType === 'azure-openai' && !config.env?.apiVersion) {\n  config.env.apiVersion = AZURE_API_VERSION; // safe default\n}","typeGuard":"const isCompleteAzureConfig = (c: AzureConfig): boolean =>\n  c.env?.apiType === 'azure-api-key' || Boolean(c.env?.deployment && c.env?.apiVersion);","tryCatchPattern":"try { new AzureApi(config); } catch (e) {\n  if (e instanceof Error && e.message.includes('env.apiVersion')) {\n    config.env.apiVersion = '2024-02-01';\n    return new AzureApi(config);\n  }\n  throw e;\n}","preventionTips":["Default apiVersion in your config layer instead of requiring every user to know it","Re-validate Azure config after any config-file edit or migration"],"tags":["azure","openai","config","api-version","required-field"],"backgroundTag":"missing-required-config","analyzedSha":"5522c6f44ca0ac3528b37244818fbfa39b5af470","analyzedAt":"2026-08-27T11:28:54.683Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}