{"record":{"id":"d620a61435077518","repo":"microsoft/semantic-kernel","slug":"the-amazon-bedrock-chat-model-id-is-missing","errorCode":null,"errorMessage":"The Amazon Bedrock Chat Model ID is missing.","messagePattern":"The Amazon Bedrock Chat Model ID is missing\\.","errorType":"exception","errorClass":"ServiceInitializationError","httpStatus":null,"severity":"error","filePath":"python/semantic_kernel/connectors/ai/bedrock/services/bedrock_chat_completion.py","lineNumber":90,"sourceCode":"            model_provider: The Bedrock model provider to use.\n            service_id: The Service ID for the completion service.\n            runtime_client: The Amazon Bedrock runtime client to use.\n            client: The Amazon Bedrock client to use.\n            env_file_path: The path to the .env file.\n            env_file_encoding: The encoding of the .env file.\n        \"\"\"\n        try:\n            bedrock_settings = BedrockSettings(\n                chat_model_id=model_id,\n                model_provider=model_provider,\n                env_file_path=env_file_path,\n                env_file_encoding=env_file_encoding,\n            )\n        except ValidationError as e:\n            raise ServiceInitializationError(\"Failed to initialize the Amazon Bedrock Chat Completion Service.\") from e\n\n        if bedrock_settings.chat_model_id is None:\n            raise ServiceInitializationError(\"The Amazon Bedrock Chat Model ID is missing.\")\n\n        super().__init__(\n            ai_model_id=bedrock_settings.chat_model_id,\n            service_id=service_id or bedrock_settings.chat_model_id,\n            runtime_client=runtime_client,\n            client=client,\n            bedrock_model_provider=bedrock_settings.model_provider,\n        )\n\n    # region Overriding base class methods\n\n    # Override from AIServiceClientBase\n    @override\n    def get_prompt_execution_settings_class(self) -> type[\"PromptExecutionSettings\"]:\n        return BedrockChatPromptExecutionSettings\n\n    @override\n    @trace_chat_completion(BedrockBase.MODEL_PROVIDER_NAME)","sourceCodeStart":72,"sourceCodeEnd":108,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/python/semantic_kernel/connectors/ai/bedrock/services/bedrock_chat_completion.py#L72-L108","documentation":"Raised during BedrockChatCompletion construction when BedrockSettings parses successfully but chat_model_id ends up None. This means no chat model id was supplied via the model_id argument, inferred from model_provider, or loaded from environment — the service cannot target any model.","triggerScenarios":"Calling BedrockChatCompletion() without model_id and with no BEDROCK chat model id in the environment/settings, or passing model_provider without a corresponding chat_model_id that can be resolved.","commonSituations":"Forgetting to pass model_id; expecting it to come from env but the env var is unset; misconfiguring model_provider-only construction; CI without seeded model config.","solutions":["Pass a valid chat model_id explicitly, e.g. BedrockChatCompletion(model_id=\"anthropic.claude-3-sonnet-20240229-v1:0\").","Set the relevant BEDROCK model env var if your settings expect one.","If using model_provider, still supply the concrete model_id."],"exampleFix":"# before\nservice = BedrockChatCompletion()  # no model id → error\n\n# after\nservice = BedrockChatCompletion(model_id=\"anthropic.claude-3-sonnet-20240229-v1:0\")","handlingStrategy":"validation","validationCode":"assert model_id, \"A chat model_id is required for BedrockChatCompletion\"\nservice = BedrockChatCompletion(model_id=model_id)","typeGuard":"def has_chat_model_id(model_id) -> bool:\n    return bool(model_id)","tryCatchPattern":"from semantic_kernel.exceptions import ServiceInitializationError\ntry:\n    service = BedrockChatCompletion(model_id=model_id)\nexcept ServiceInitializationError as e:\n    if \"Chat Model ID\" in str(e):\n        service = BedrockChatCompletion(model_id=\"anthropic.claude-3-sonnet-20240229-v1:0\")","preventionTips":["Always pass a concrete chat model_id.","Seed model config in env for CI.","Don't rely on provider-only construction."],"tags":["bedrock","configuration","service-init","model-id","python"],"backgroundTag":null,"analyzedSha":"c028a0c7dc4f0814cdcbaba9d998f187a41197bf","analyzedAt":"2026-08-13T13:48:05.040Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}