{"record":{"id":"c0c0e54872bd9d53","repo":"crewAIInc/crewAI","slug":"agent-alias-id-cannot-be-empty","errorCode":null,"errorMessage":"agent_alias_id cannot be empty","messagePattern":"agent_alias_id cannot be empty","errorType":"validation","errorClass":"BedrockValidationError","httpStatus":null,"severity":"error","filePath":"lib/crewai-tools/src/crewai_tools/aws/bedrock/agents/invoke_agent_tool.py","lineNumber":82,"sourceCode":"        )  # Use timestamp as session ID if not provided\n        self.enable_trace = enable_trace\n        self.end_session = end_session\n\n        if description:\n            self.description = description\n\n        self._validate_parameters()\n\n    def _validate_parameters(self) -> None:\n        \"\"\"Validate the parameters according to AWS API requirements.\"\"\"\n        try:\n            if not self.agent_id:\n                raise BedrockValidationError(\"agent_id cannot be empty\")\n            if not isinstance(self.agent_id, str):\n                raise BedrockValidationError(\"agent_id must be a string\")\n\n            if not self.agent_alias_id:\n                raise BedrockValidationError(\"agent_alias_id cannot be empty\")\n            if not isinstance(self.agent_alias_id, str):\n                raise BedrockValidationError(\"agent_alias_id must be a string\")\n\n            if self.session_id and not isinstance(self.session_id, str):\n                raise BedrockValidationError(\"session_id must be a string\")\n\n        except BedrockValidationError as e:\n            raise BedrockValidationError(f\"Parameter validation failed: {e!s}\") from e\n\n    def _run(self, query: str) -> str:\n        try:\n            import boto3\n            from botocore.exceptions import ClientError\n        except ImportError as e:\n            raise ImportError(\n                \"`boto3` package not found, please run `uv add boto3`\"\n            ) from e\n","sourceCodeStart":64,"sourceCodeEnd":100,"githubUrl":"https://github.com/crewAIInc/crewAI/blob/754d7323beb2fd042e33444a115ea2d5a47193f0/lib/crewai-tools/src/crewai_tools/aws/bedrock/agents/invoke_agent_tool.py#L64-L100","documentation":"A BedrockValidationError raised when agent_alias_id is falsy (None or empty string). Bedrock's InvokeAgent API requires an alias ID (e.g. 'TSTALIASID' for a draft/test alias), so the tool validates it in __init__ and re-wraps the message as \"Parameter validation failed: agent_alias_id cannot be empty\".","triggerScenarios":"Constructing BedrockAgentTools with agent_alias_id='' or None while agent_id passed its checks. Often happens when the developer only knows the agent_id and assumes the alias is optional.","commonSituations":"New Bedrock Agents users who have not created a prepared alias yet; reading the alias from a missing env var; or assuming the draft alias is auto-selected when omitted — this tool requires it explicitly.","solutions":["Use the test alias 'TSTALIASID' for a draft agent, or the real alias ID shown in the Bedrock console under Aliases.","Prepare the agent in the AWS console first so an alias exists, then copy its ID.","Wire config the same way as agent_id: os.environ['BEDROCK_AGENT_ALIAS_ID']."],"exampleFix":"# before\ntool = BedrockAgentTools(agent_id=\"ABCD123456\", agent_alias_id=\"\")\n\n# after\ntool = BedrockAgentTools(agent_id=\"ABCD123456\", agent_alias_id=\"TSTALIASID\")","handlingStrategy":"validation","validationCode":"alias = os.environ.get(\"BEDROCK_AGENT_ALIAS_ID\", \"TSTALIASID\")  # default to draft alias\nassert alias, \"agent_alias_id required\"","typeGuard":"def is_agent_alias_id(v) -> bool:\n    return isinstance(v, str) and len(v) > 0","tryCatchPattern":"try:\n    tool = BedrockAgentTools(agent_id=aid, agent_alias_id=alias)\nexcept BedrockValidationError as e:\n    raise ValueError(f\"Bad Bedrock alias config: {e}\") from e","preventionTips":["Use 'TSTALIASID' for draft agents; create and prepare a real alias for production.","Treat agent_alias_id as mandatory config next to agent_id, not optional.","Verify the alias exists in the Bedrock console before deploying."],"tags":["aws","bedrock","validation","configuration"],"backgroundTag":null,"analyzedSha":"754d7323beb2fd042e33444a115ea2d5a47193f0","analyzedAt":"2026-08-15T04:06:56.746Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}