{"record":{"id":"fe2ab1586964d64b","repo":"BerriAI/litellm","slug":"invalid-batch-id-format-expected-arn-got-batch","errorCode":null,"errorMessage":"Invalid batch_id format. Expected ARN, got: {batch_id}","messagePattern":"Invalid batch_id format\\. Expected ARN, got: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/llms/bedrock/batches/transformation.py","lineNumber":375,"sourceCode":"        batch_id: str,\n        optional_params: dict,\n        litellm_params: dict,\n    ) -> dict[str, Any]:\n        \"\"\"\n        Transform batch retrieval request for Bedrock.\n\n        Args:\n            batch_id: Bedrock job ARN\n            optional_params: Optional parameters\n            litellm_params: LiteLLM parameters\n\n        Returns:\n            Transformed request data for Bedrock GetModelInvocationJob API\n        \"\"\"\n        # For Bedrock, batch_id should be the full job ARN\n        # The GetModelInvocationJob API expects the full ARN as the identifier\n        if not batch_id.startswith(\"arn:aws:bedrock:\"):\n            raise ValueError(f\"Invalid batch_id format. Expected ARN, got: {batch_id}\")\n\n        # Extract the job identifier from the ARN - use the full ARN path part\n        # ARN format: arn:aws:bedrock:region:account:model-invocation-job/job-name\n        arn_parts: Final = batch_id.split(\":\")\n        if len(arn_parts) < 6:\n            raise ValueError(f\"Invalid ARN format: {batch_id}\")\n\n        region: Final = arn_parts[3]\n        if not re.match(r\"^[a-z][a-z0-9-]*$\", region):\n            raise ValueError(f\"Invalid region in ARN: {batch_id}\")\n\n        # Build the endpoint URL for GetModelInvocationJob\n        # AWS API format: GET /model-invocation-job/{jobIdentifier}\n        # Use the FULL ARN as jobIdentifier and URL-encode it (includes ':' and '/')\n        import urllib.parse as _ul\n\n        encoded_arn: Final = _ul.quote(batch_id, safe=\"\")\n        endpoint_url: Final = f\"https://bedrock.{region}.amazonaws.com/model-invocation-job/{encoded_arn}\"","sourceCodeStart":357,"sourceCodeEnd":393,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/llms/bedrock/batches/transformation.py#L357-L393","documentation":"Error \"Invalid batch_id format. Expected ARN, got: {batch_id}\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/llms/bedrock/batches/transformation.py:375 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass the batch_id as a full Bedrock batch job ARN."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}