{"record":{"id":"676b1eaab5c77078","repo":"crewAIInc/crewAI","slug":"parameter-validation-failed-e-s","errorCode":null,"errorMessage":"Parameter validation failed: {e!s}","messagePattern":"Parameter validation failed: (.+?)","errorType":"validation","errorClass":"BedrockValidationError","httpStatus":null,"severity":"error","filePath":"lib/crewai-tools/src/crewai_tools/aws/bedrock/agents/invoke_agent_tool.py","lineNumber":90,"sourceCode":"\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\n        try:\n            # Initialize the Bedrock Agent Runtime client\n            bedrock_agent = boto3.client(\n                \"bedrock-agent-runtime\",\n                region_name=os.getenv(\n                    \"AWS_REGION\", os.getenv(\"AWS_DEFAULT_REGION\", \"us-west-2\")\n                ),\n            )","sourceCodeStart":72,"sourceCodeEnd":108,"githubUrl":"https://github.com/crewAIInc/crewAI/blob/754d7323beb2fd042e33444a115ea2d5a47193f0/lib/crewai-tools/src/crewai_tools/aws/bedrock/agents/invoke_agent_tool.py#L72-L108","documentation":"The wrapper message produced by the `except BedrockValidationError` clause in _validate_parameters: any of the individual parameter failures (empty/wrong-type agent_id, agent_alias_id, session_id) is re-raised as \"Parameter validation failed: <original message>\" with the original as __cause__. It is the single surfaced error for all constructor-time validation problems in the invoke-agent tool.","triggerScenarios":"Any BedrockAgentTools construction whose agent_id/agent_alias_id/session_id fails empty-check or isinstance-check — the inner raise at lines 77-87 is caught here and re-wrapped. The original specific message appears after the colon.","commonSituations":"Generic wrapper users see in stack traces when any parameter is wrong; diagnosing requires reading the suffix (e.g. 'Parameter validation failed: agent_id cannot be empty') rather than the wrapper itself.","solutions":["Read the text after 'Parameter validation failed:' — it names the exact field and problem.","Fix that field per its specific rule (non-empty str agent_id, non-empty str agent_alias_id, optional str session_id).","Validate inputs before construction (see validation code) so the error never fires."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"import re\n\ndef validate_invoke_agent_cfg(agent_id, agent_alias_id, session_id=None) -> None:\n    assert isinstance(agent_id, str) and agent_id, \"agent_id must be non-empty str\"\n    assert isinstance(agent_alias_id, str) and agent_alias_id, \"agent_alias_id must be non-empty str\"\n    assert session_id is None or isinstance(session_id, str), \"session_id must be str\"","typeGuard":null,"tryCatchPattern":"try:\n    tool = BedrockAgentTools(agent_id=aid, agent_alias_id=alias, session_id=sid)\nexcept BedrockValidationError as e:\n    # message suffix names the exact bad field\n    raise ValueError(f\"Bedrock agent tool misconfigured: {e}\") from e","preventionTips":["Centralize Bedrock config in one typed (pydantic) model validated at startup.","Read the suffix of 'Parameter validation failed:' — it names the offending field.","Write a startup smoke test that constructs every AWS tool so config errors fail at deploy, not at agent runtime."],"tags":["aws","bedrock","validation","wrapper"],"backgroundTag":null,"analyzedSha":"754d7323beb2fd042e33444a115ea2d5a47193f0","analyzedAt":"2026-08-15T04:06:56.746Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}