continuedev/continue · error · Error
`env.apiVersion` is a required configuration property for Az
Error message
`env.apiVersion` is a required configuration property for Azure OpenAI
What it means
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').
Source
Thrown at packages/openai-adapters/src/apis/Azure.ts:62
// Copy search params to separate object for OpenAI
const queryParams: Record<string, string> = {};
for (const [key, value] of url.searchParams.entries()) {
queryParams[key] = value;
}
url.pathname = url.pathname.replace(/\/$/, ""); // Remove trailing slash if present
url.search = ""; // Clear original search params
// Default is `azure-openai` in docs, but previously was `azure`
if (this._isAzureOpenAI(config.env?.apiType)) {
if (!config.env?.deployment) {
throw new Error(
"`env.deployment` is a required configuration property for Azure OpenAI",
);
}
if (!config.env?.apiVersion) {
throw new Error(
"`env.apiVersion` is a required configuration property for Azure OpenAI",
);
}
const basePathname = `openai/deployments/${config.env.deployment}`;
url.pathname =
url.pathname === "/" ? basePathname : `${url.pathname}/${basePathname}`;
queryParams["api-version"] = config.env.apiVersion;
}
return {
baseURL: url.toString(),
defaultQuery: queryParams,
};
}
View on GitHub (pinned to 5522c6f44c)
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
Example fix
// before
{ provider: 'azure', apiType: 'azure-openai', apiKey: '...', deployment: 'my-deploy' }
// after
{ provider: 'azure', apiType: 'azure-openai', apiKey: '...', deployment: 'my-deploy', apiVersion: '2024-02-01' } Defensive patterns
Strategy: validation
Validate before calling
const AZURE_API_VERSION = '2024-02-01';
if (config.env?.apiType === 'azure-openai' && !config.env?.apiVersion) {
config.env.apiVersion = AZURE_API_VERSION; // safe default
} Type guard
const isCompleteAzureConfig = (c: AzureConfig): boolean => c.env?.apiType === 'azure-api-key' || Boolean(c.env?.deployment && c.env?.apiVersion);
Try / catch
try { new AzureApi(config); } catch (e) {
if (e instanceof Error && e.message.includes('env.apiVersion')) {
config.env.apiVersion = '2024-02-01';
return new AzureApi(config);
}
throw e;
} Prevention
- 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
When it happens
Trigger: Configuring apiType: 'azure-openai' with a deployment but no env.apiVersion; the defaultQuery getter calls _getAzureBaseURL which enforces the requirement.
Common situations: 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.
Understand the failure class
Background: "X is required", "must be set", "cannot be empty": the missing-required-config error family, from Vertex AI project/location to WeChat keys — this error's family across 18 libraries.
Related errors
- `env.deployment` is a required configuration property for Az
- [Continue] Azure endpoint detected but API key appears to be
- Profile ${profileId} not found
- No reranker set up
- No chat model selected
AI-assisted analysis of continuedev/continue@5522c6f44c (2026-08-27).
Data as JSON: /api/errors/0d74010db7413804.
Report an issue: GitHub.