aaif-goose/goose · error

AZURE_FOUNDRY_MODEL is required for MaaS endpoints

Error message

AZURE_FOUNDRY_MODEL is required for MaaS endpoints

What it means

AzureFoundryProvider::create classifies AZURE_FOUNDRY_ENDPOINT via endpoint_kind(): URLs containing '/api/projects/' are Project endpoints, hosts ending in '.services.ai.azure.com' are Resource endpoints, and everything else — typically the older 'https://<deployment>.<region>.models.ai.azure.com' URLs — is treated as MaaS (Model-as-a-Service). MaaS endpoints have no model directory API, so the deployment name must come from the AZURE_FOUNDRY_MODEL config key; when it is missing, None, or whitespace, creation fails here.

Source

Thrown at crates/goose-providers/src/azure_foundry.rs:183

        maas_model: Option<String>,
        chat_auth: AuthMethod,
        responses_auth: AuthMethod,
        anthropic_auth: AuthMethod,
        deployments_auth: AuthMethod,
        tls_config: Option<TlsConfig>,
        request_builder: Option<RequestBuilderDecorator>,
    ) -> Result<Self> {
        let endpoint = endpoint.trim_end_matches('/').to_string();
        let endpoint_kind = endpoint_kind(&endpoint);
        let native_inference = endpoint_kind != EndpointKind::Maas;
        let maas_model = if native_inference {
            None
        } else {
            Some(
                maas_model
                    .filter(|model| !model.trim().is_empty())
                    .ok_or_else(|| {
                        anyhow::anyhow!("AZURE_FOUNDRY_MODEL is required for MaaS endpoints")
                    })?
                    .trim()
                    .to_string(),
            )
        };
        let chat_prefix = if native_inference {
            "openai/v1/"
        } else {
            "v1/"
        };

        let chat_client = configured_client(
            endpoint.clone(),
            chat_auth,
            tls_config.clone(),
            request_builder.clone(),
        )?;
        let chat = OpenAiCompatibleProvider::new(

View on GitHub (pinned to 3810898a74)

Solutions

  1. Set the deployment model: export AZURE_FOUNDRY_MODEL="gpt-4o" (the deployment name, not the endpoint)
  2. Or migrate to the newer Resource endpoint form https://<resource>.services.ai.azure.com which needs no model env var
  3. Or use a Project endpoint URL containing /api/projects/<id>
  4. Verify the endpoint string has no typos in the host suffix so classification is what you expect

Example fix

# before
export AZURE_FOUNDRY_ENDPOINT="https://my-deployment.eastus.models.ai.azure.com"
# AZURE_FOUNDRY_MODEL unset -> error at provider creation

# after (MaaS: name the deployment)
export AZURE_FOUNDRY_MODEL="gpt-4o"
# or: use resource endpoint instead
export AZURE_FOUNDRY_ENDPOINT="https://my-resource.services.ai.azure.com"
Defensive patterns

Strategy: validation

Validate before calling

fn azure_foundry_ready(endpoint: &str, model: Option<&str>) -> anyhow::Result<()> {
    let kind = endpoint_kind(endpoint); // EndpointKind::{Maas,Resource,Project}
    if kind == EndpointKind::Maas {
        anyhow::ensure!(model.map(|m| !m.trim().is_empty()).unwrap_or(false),
            "AZURE_FOUNDRY_MODEL is required for MaaS endpoint {endpoint}");
    }
    Ok(())
}

Try / catch

// Check env before constructing the provider so the user gets a config error,
// not a runtime anyhow chain:
let model = std::env::var("AZURE_FOUNDRY_MODEL").ok();
azure_foundry_ready(&endpoint, model.as_deref())?;
AzureFoundryProvider::create(endpoint, api_version, model, ...)?;

Prevention

When it happens

Trigger: AZURE_FOUNDRY_ENDPOINT points at a models.ai.azure.com MaaS URL while AZURE_FOUNDRY_MODEL is unset, set to an empty string, or contains only whitespace; or a Resource/Project endpoint was typo'd (e.g. '.services.azure.com') so it accidentally classifies as MaaS.

Common situations: Following older Azure docs that hand out MaaS endpoint URLs; copying the endpoint from the Azure portal's 'Target URI' which is MaaS-shaped; CI environments that export AZURE_FOUNDRY_ENDPOINT but not AZURE_FOUNDRY_MODEL.

Related errors


AI-assisted analysis of aaif-goose/goose@3810898a74 (2026-08-16). Data as JSON: /api/errors/1aeb8a0b3e90e066. Report an issue: GitHub.