{"record":{"id":"e49c7f1585440315","repo":"BerriAI/litellm","slug":"azureexception-notfounderror-message","errorCode":null,"errorMessage":"AzureException NotFoundError - {message}","messagePattern":"AzureException NotFoundError - (.+?)","errorType":"exception","errorClass":"NotFoundError","httpStatus":404,"severity":"critical","filePath":"litellm/litellm_core_utils/exception_mapping_utils.py","lineNumber":1913,"sourceCode":"\n    if \"Internal server error\" in error_str:\n        raise litellm.InternalServerError(\n            message=f\"AzureException Internal server error - {message}\",\n            llm_provider=\"azure\",\n            model=model,\n            litellm_debug_info=extra_information,\n            response=getattr(original_exception, \"response\", None),\n        )\n    elif \"This model's maximum context length is\" in error_str:\n        raise ContextWindowExceededError(\n            message=f\"AzureException ContextWindowExceededError - {message}\",\n            llm_provider=\"azure\",\n            model=model,\n            litellm_debug_info=extra_information,\n            response=getattr(original_exception, \"response\", None),\n        )\n    elif \"DeploymentNotFound\" in error_str:\n        raise NotFoundError(\n            message=f\"AzureException NotFoundError - {message}\",\n            llm_provider=\"azure\",\n            model=model,\n            litellm_debug_info=extra_information,\n            response=getattr(original_exception, \"response\", None),\n        )\n    elif azure_error_code == \"content_policy_violation\" or ExceptionCheckers.is_azure_content_policy_violation_error(\n        error_str\n    ):\n        from litellm.llms.azure.exception_mapping import (\n            AzureOpenAIExceptionMapping,\n        )\n\n        raise AzureOpenAIExceptionMapping.create_content_policy_violation_error(\n            message=message,\n            model=model,\n            extra_information=extra_information,\n            original_exception=original_exception,","sourceCodeStart":1895,"sourceCodeEnd":1931,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/litellm_core_utils/exception_mapping_utils.py#L1895-L1931","documentation":"litellm maps Azure OpenAI 'DeploymentNotFound' errors to litellm.NotFoundError. Azure could not resolve the deployment name in the URL - the named deployment does not exist under that resource and API version.","triggerScenarios":"Calling model='azure/<deployment>' where <deployment> does not match an actual deployment name in the Azure OpenAI resource: typos, deployment deleted/renamed, wrong resource (multiple accounts), or an api_version that no longer resolves the deployment.","commonSituations":"Env-specific config drift (dev deployment name used in prod), deployments recreated after region moves with new names, api_version deprecations, or base_url pointing at the wrong resource.","solutions":["Check the deployment name in Azure portal (Azure OpenAI > Deployments) and make it match the litellm model string exactly (case-sensitive)","Verify api_base points at the right resource and api_version is current","If the deployment was renamed, update config/env (AZURE_API_BASE, AZURE_DEPLOYMENT_NAME or model_list entries)","Use azure/deployment or explicit azure_deployment= param rather than embedding names in code","Redeploy the model if it was deleted"],"exampleFix":"# before\nlitellm.completion(model='azure/gpt4o-prod', messages=msgs)  # actual name: gpt-4o-prod\n# after\nlitellm.completion(model='azure/gpt-4o-prod', messages=msgs,\n                   api_base=os.environ['AZURE_API_BASE'], api_key=os.environ['AZURE_API_KEY'],\n                   api_version='2024-10-21')","handlingStrategy":"validation","validationCode":"from azure.identity import DefaultAzureCredential\nfrom azure.mgmt.cognitiveservices import CognitiveServicesManagementClient\nsub, rg, res = '<sub>', '<rg>', '<resource>'\nclient = CognitiveServicesManagementClient(DefaultAzureCredential(), sub)\nnames = {d.name for d in client.deployments.list(rg, res)}\nassert 'gpt-4o-prod' in names, f'deployment missing; have {names}'","typeGuard":"import litellm\n\ndef is_azure_deployment_missing(e: Exception) -> bool:\n    return isinstance(e, litellm.NotFoundError) and 'DeploymentNotFound' in str(e)","tryCatchPattern":"try:\n    litellm.completion(model='azure/gpt-4o-prod', messages=msgs)\nexcept litellm.NotFoundError as e:\n    if 'DeploymentNotFound' in str(e):\n        raise RuntimeError('deployment name mismatch - check Azure portal')\n    raise","preventionTips":["Source deployment names from infra config (terraform outputs), not literals","Assert deployment existence in smoke tests per environment","Pin api_version and review Azure deprecation notices quarterly"],"tags":["azure","deployment-not-found","configuration","litellm"],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}