BerriAI/litellm · error · RuntimeError

Failed to create OpenSearch index after {max_retries} attemp

Error message

Failed to create OpenSearch index after {max_retries} attempts. Data access policy may not have propagated. Last error: {last_error}

What it means

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.

Source

Thrown at litellm/rag/ingestion/bedrock_ingestion.py:435

                verbose_logger.info("Created OpenSearch index: %s", index_name)
                return
            except Exception as e:
                last_error = e
                error_str = str(e)
                if "authorization_exception" in error_str.lower() or "security_exception" in error_str.lower():
                    verbose_logger.warning(
                        "OpenSearch index creation attempt %s/%s failed due to authorization. Waiting %ss for policy propagation...",
                        attempt + 1,
                        max_retries,
                        retry_delay,
                    )
                    await asyncio.sleep(retry_delay)
                else:
                    # Non-auth error, raise immediately
                    raise

        # All retries exhausted
        raise RuntimeError(
            f"Failed to create OpenSearch index after {max_retries} attempts. "
            f"Data access policy may not have propagated. Last error: {last_error}"
        )

    async def _create_bedrock_role(self, unique_id: str, account_id: str, collection_arn: str) -> str:
        """Create IAM role for Bedrock KB."""
        iam: Final = self._get_boto3_client("iam")
        role_name: Final = f"litellm-bedrock-kb-{unique_id}"

        verbose_logger.debug("Creating IAM role: %s", role_name)

        trust_policy: Final = {
            "Version": "2012-10-17",
            "Statement": [
                {
                    "Effect": "Allow",
                    "Principal": {"Service": "bedrock.amazonaws.com"},
                    "Action": "sts:AssumeRole",

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Wait for the data access policy to propagate and retry; verify the policy grants index creation permissions.
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at litellm/rag/ingestion/bedrock_ingestion.py:435 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18). Data as JSON: /api/errors/6927c503197cb692. Report an issue: GitHub.