{"record":{"id":"4734ef6cd0c6dc9c","repo":"microsoft/semantic-kernel","slug":"invalid-settings-exc-4734ef","errorCode":null,"errorMessage":"Invalid settings: {exc}","messagePattern":"Invalid settings: (.+?)","errorType":"exception","errorClass":"ServiceInitializationError","httpStatus":null,"severity":"error","filePath":"python/semantic_kernel/connectors/ai/open_ai/services/azure_text_embedding.py","lineNumber":77,"sourceCode":"        default_headers: The default headers mapping of string keys to\n                string values for HTTP requests. (Optional)\n        async_client (Optional[AsyncAzureOpenAI]): An existing client to use. (Optional)\n        env_file_path (str | None): Use the environment settings file as a fallback to\n            environment variables. (Optional)\n        credential (TokenCredential): The credential to use for authentication.\n        \"\"\"\n        try:\n            azure_openai_settings = AzureOpenAISettings(\n                env_file_path=env_file_path,\n                api_key=api_key,\n                embedding_deployment_name=deployment_name,\n                endpoint=endpoint,\n                base_url=base_url,\n                api_version=api_version,\n                token_endpoint=token_endpoint,\n            )\n        except ValidationError as exc:\n            raise ServiceInitializationError(f\"Invalid settings: {exc}\") from exc\n        if not azure_openai_settings.embedding_deployment_name:\n            raise ServiceInitializationError(\"The Azure OpenAI embedding deployment name is required.\")\n\n        super().__init__(\n            deployment_name=azure_openai_settings.embedding_deployment_name,\n            endpoint=azure_openai_settings.endpoint,\n            base_url=azure_openai_settings.base_url,\n            api_version=azure_openai_settings.api_version,\n            service_id=service_id,\n            api_key=azure_openai_settings.api_key.get_secret_value() if azure_openai_settings.api_key else None,\n            ad_token=ad_token,\n            ad_token_provider=ad_token_provider,\n            token_endpoint=azure_openai_settings.token_endpoint,\n            default_headers=default_headers,\n            ai_model_type=OpenAIModelTypes.EMBEDDING,\n            client=async_client,\n            credential=credential,\n        )","sourceCodeStart":59,"sourceCodeEnd":95,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/python/semantic_kernel/connectors/ai/open_ai/services/azure_text_embedding.py#L59-L95","documentation":"Raised by AzureTextEmbedding.__init__ when AzureOpenAISettings construction throws a pydantic ValidationError. The settings model validates endpoint (HttpsUrl), base_url (Url), api_key (SecretStr), api_version (str). This class is decorated @experimental. Any field value that cannot be coerced to its declared type triggers the wrapped error.","triggerScenarios":"Constructing AzureTextEmbedding with a non-HTTPS endpoint, a malformed base_url, or an AZURE_OPENAI_ENDPOINT env var with an invalid URL. Also triggered by passing api_version as a non-string.","commonSituations":"Passing endpoint='http://...' (HttpsUrl requires https scheme); bare hostname without scheme; .env file with corrupted values; environment variable set to an empty string in CI.","solutions":["Inspect the chained ValidationError to identify the specific field and constraint that failed.","Ensure endpoint is a valid https:// URL ending in openai.azure.com.","Verify .env file syntax and that AZURE_OPENAI_ENDPOINT is correctly formatted.","Pass api_version as a string literal."],"exampleFix":"# before\nservice = AzureTextEmbedding(\n    deployment_name='text-embedding-3-large',\n    endpoint='http://myresource.openai.azure.com',  # http rejected\n    api_key='...',\n)\n# after\nservice = AzureTextEmbedding(\n    deployment_name='text-embedding-3-large',\n    endpoint='https://myresource.openai.azure.com',\n    api_key='...',\n)","handlingStrategy":"try-catch","validationCode":"from urllib.parse import urlparse\n\ndef validate_azure_endpoint(endpoint: str | None) -> str:\n    if endpoint is None:\n        raise ValueError('endpoint is required')\n    parsed = urlparse(endpoint)\n    if parsed.scheme != 'https':\n        raise ValueError(f'endpoint must use https:// scheme, got {parsed.scheme}://')\n    return endpoint\n\nvalidate_azure_endpoint(os.environ.get('AZURE_OPENAI_ENDPOINT'))","typeGuard":null,"tryCatchPattern":"from semantic_kernel.exceptions.service_exceptions import ServiceInitializationError\n\ntry:\n    service = AzureTextEmbedding(\n        deployment_name='text-embedding-3-large',\n        endpoint='https://myresource.openai.azure.com',\n        api_key='...',\n    )\nexcept ServiceInitializationError as e:\n    cause = e.__cause__\n    if cause:\n        print(f'Settings validation failed: {cause}')\n    raise","preventionTips":["Always use https:// for Azure OpenAI endpoints.","Validate endpoint URL format before constructing the service.","Read the chained ValidationError (__cause__) for the specific field that failed.","Keep .env file syntax clean and verify environment variable values."],"tags":["azure-openai","embedding","pydantic","settings-validation","experimental"],"backgroundTag":null,"analyzedSha":"c028a0c7dc4f0814cdcbaba9d998f187a41197bf","analyzedAt":"2026-08-13T13:48:05.040Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}