continuedev/continue · error · Error

`env.deployment` is a required configuration property for…

Error message

`env.deployment` is a required configuration property for Azure OpenAI

What it means

When the Azure adapter is configured with apiType 'azure-openai' (Azure's native deployment-based API rather than the azure-api-key gateway mode), it builds a /openai/deployments/{deployment}/... URL and therefore requires a deployment name. This constructor-time validation in _getAzureBaseURL throws if env.deployment is missing so the request fails before hitting the network with a confusing 404.

Solutions

  1. Add env.deployment set to your Azure deployment name (not the model name) in the Azure config
  2. Confirm you actually want the azure-openai apiType; if using the azure-api-key gateway mode, set apiType: 'azure-api-key' instead
  3. Verify the deployment name in Azure Portal under Azure OpenAI -> Deployments

Example fix

// before
{ provider: 'azure', apiType: 'azure-openai', apiKey: '...', apiVersion: '2024-02-01' }

// after
{ provider: 'azure', apiType: 'azure-openai', apiKey: '...', apiVersion: '2024-02-01', deployment: 'my-gpt4o-deployment' }
Defensive patterns

Strategy: validation

Validate before calling

if (config.provider === 'azure' && config.env?.apiType !== 'azure-api-key') {
  if (!config.env?.deployment) {
    throw new ConfigError('azure-openai requires env.deployment');
  }
}

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.deployment')) {
    // prompt user for deployment name or fall back to gateway mode
  }
  throw e;
}

Prevention

When it happens

Trigger: Setting apiType: 'azure-openai' (or relying on the newer default) in config.env without a deployment property; _getAzureBaseURL is invoked via the baseURL/defaultQuery getters whenever a request is prepared.

Common situations: Migrating from the legacy apiType 'azure' (which used model-name URLs) to 'azure-openai' and not adding deployment; using the Azure OpenAI v1 API where deployments are named separately from model names; typos like deployName or deploymentName instead of deployment.

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


AI-assisted analysis of continuedev/continue@5522c6f44c (2026-08-27). Data as JSON: /api/errors/458a49b90b22d4ab. Report an issue: GitHub.

Appendix: source

Thrown at packages/openai-adapters/src/apis/Azure.ts:56

  private _getAzureBaseURL(config: z.infer<typeof AzureConfigSchema>): {
    baseURL: string;
    defaultQuery: Record<string, string>;
  } {
    const url = new URL(this.apiBase);

    // 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;
    }

View on GitHub (pinned to 5522c6f44c)