{"record":{"id":"1aeb8a0b3e90e066","repo":"aaif-goose/goose","slug":"azure-foundry-model-is-required-for-maas-endpoints","errorCode":null,"errorMessage":"AZURE_FOUNDRY_MODEL is required for MaaS endpoints","messagePattern":"AZURE_FOUNDRY_MODEL is required for MaaS endpoints","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/goose-providers/src/azure_foundry.rs","lineNumber":183,"sourceCode":"        maas_model: Option<String>,\n        chat_auth: AuthMethod,\n        responses_auth: AuthMethod,\n        anthropic_auth: AuthMethod,\n        deployments_auth: AuthMethod,\n        tls_config: Option<TlsConfig>,\n        request_builder: Option<RequestBuilderDecorator>,\n    ) -> Result<Self> {\n        let endpoint = endpoint.trim_end_matches('/').to_string();\n        let endpoint_kind = endpoint_kind(&endpoint);\n        let native_inference = endpoint_kind != EndpointKind::Maas;\n        let maas_model = if native_inference {\n            None\n        } else {\n            Some(\n                maas_model\n                    .filter(|model| !model.trim().is_empty())\n                    .ok_or_else(|| {\n                        anyhow::anyhow!(\"AZURE_FOUNDRY_MODEL is required for MaaS endpoints\")\n                    })?\n                    .trim()\n                    .to_string(),\n            )\n        };\n        let chat_prefix = if native_inference {\n            \"openai/v1/\"\n        } else {\n            \"v1/\"\n        };\n\n        let chat_client = configured_client(\n            endpoint.clone(),\n            chat_auth,\n            tls_config.clone(),\n            request_builder.clone(),\n        )?;\n        let chat = OpenAiCompatibleProvider::new(","sourceCodeStart":165,"sourceCodeEnd":201,"githubUrl":"https://github.com/aaif-goose/goose/blob/3810898a7447ec3299be72e223d3570a7aabf0ab/crates/goose-providers/src/azure_foundry.rs#L165-L201","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Set the deployment model: export AZURE_FOUNDRY_MODEL=\"gpt-4o\" (the deployment name, not the endpoint)","Or migrate to the newer Resource endpoint form https://<resource>.services.ai.azure.com which needs no model env var","Or use a Project endpoint URL containing /api/projects/<id>","Verify the endpoint string has no typos in the host suffix so classification is what you expect"],"exampleFix":"# before\nexport AZURE_FOUNDRY_ENDPOINT=\"https://my-deployment.eastus.models.ai.azure.com\"\n# AZURE_FOUNDRY_MODEL unset -> error at provider creation\n\n# after (MaaS: name the deployment)\nexport AZURE_FOUNDRY_MODEL=\"gpt-4o\"\n# or: use resource endpoint instead\nexport AZURE_FOUNDRY_ENDPOINT=\"https://my-resource.services.ai.azure.com\"","handlingStrategy":"validation","validationCode":"fn azure_foundry_ready(endpoint: &str, model: Option<&str>) -> anyhow::Result<()> {\n    let kind = endpoint_kind(endpoint); // EndpointKind::{Maas,Resource,Project}\n    if kind == EndpointKind::Maas {\n        anyhow::ensure!(model.map(|m| !m.trim().is_empty()).unwrap_or(false),\n            \"AZURE_FOUNDRY_MODEL is required for MaaS endpoint {endpoint}\");\n    }\n    Ok(())\n}","typeGuard":null,"tryCatchPattern":"// Check env before constructing the provider so the user gets a config error,\n// not a runtime anyhow chain:\nlet model = std::env::var(\"AZURE_FOUNDRY_MODEL\").ok();\nazure_foundry_ready(&endpoint, model.as_deref())?;\nAzureFoundryProvider::create(endpoint, api_version, model, ...)?;","preventionTips":["Provision AZURE_FOUNDRY_MODEL in every environment that uses a models.ai.azure.com endpoint","Prefer the newer *.services.ai.azure.com resource endpoints for new work — no model env var needed","Add a startup config check (env var + endpoint shape) so misconfiguration fails before the first prompt"],"tags":["azure","configuration","env-vars","provider-setup"],"backgroundTag":null,"analyzedSha":"3810898a7447ec3299be72e223d3570a7aabf0ab","analyzedAt":"2026-08-16T10:14:26.282Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}