{"record":{"id":"6927c503197cb692","repo":"BerriAI/litellm","slug":"failed-to-create-opensearch-index-after-max-retri","errorCode":null,"errorMessage":"Failed to create OpenSearch index after {max_retries} attempts. Data access policy may not have propagated. Last error: {last_error}","messagePattern":"Failed to create OpenSearch index after (.+?) attempts\\. Data access policy may not have propagated\\. Last error: (.+?)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"litellm/rag/ingestion/bedrock_ingestion.py","lineNumber":435,"sourceCode":"                verbose_logger.info(\"Created OpenSearch index: %s\", index_name)\n                return\n            except Exception as e:\n                last_error = e\n                error_str = str(e)\n                if \"authorization_exception\" in error_str.lower() or \"security_exception\" in error_str.lower():\n                    verbose_logger.warning(\n                        \"OpenSearch index creation attempt %s/%s failed due to authorization. Waiting %ss for policy propagation...\",\n                        attempt + 1,\n                        max_retries,\n                        retry_delay,\n                    )\n                    await asyncio.sleep(retry_delay)\n                else:\n                    # Non-auth error, raise immediately\n                    raise\n\n        # All retries exhausted\n        raise RuntimeError(\n            f\"Failed to create OpenSearch index after {max_retries} attempts. \"\n            f\"Data access policy may not have propagated. Last error: {last_error}\"\n        )\n\n    async def _create_bedrock_role(self, unique_id: str, account_id: str, collection_arn: str) -> str:\n        \"\"\"Create IAM role for Bedrock KB.\"\"\"\n        iam: Final = self._get_boto3_client(\"iam\")\n        role_name: Final = f\"litellm-bedrock-kb-{unique_id}\"\n\n        verbose_logger.debug(\"Creating IAM role: %s\", role_name)\n\n        trust_policy: Final = {\n            \"Version\": \"2012-10-17\",\n            \"Statement\": [\n                {\n                    \"Effect\": \"Allow\",\n                    \"Principal\": {\"Service\": \"bedrock.amazonaws.com\"},\n                    \"Action\": \"sts:AssumeRole\",","sourceCodeStart":417,"sourceCodeEnd":453,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/rag/ingestion/bedrock_ingestion.py#L417-L453","documentation":"Exhausted-retries failure creating the OpenSearch index: every attempt failed with authorization/security exceptions because the data-access policy granting the caller index-create rights hadn't propagated yet, and the backoff window elapsed. The last AWS error is included; either retry later or verify the OpenSearch data access policy in AWS.","triggerScenarios":"Thrown at litellm/rag/ingestion/bedrock_ingestion.py:435 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Wait for the data access policy to propagate and retry; verify the policy grants index creation permissions."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}