BerriAI/litellm · error · HTTPException

Too many resource identifiers in request.

Error message

Too many resource identifiers in request.

What it means

Raised by _RawIdGuardBudget.reserve when the per-request budget of raw-provider-id guard DB lookups is exhausted: the request contains more distinct resource identifiers than allowed, protecting the database from unbounded lookup work.

Source

Thrown at litellm/proxy/pass_through_endpoints/managed_id_rewriter.py:210


class _RawIdGuardBudget:
    """Per-request de-dupe + cap for raw-provider-id guard DB lookups."""

    __slots__ = ("_remaining", "_seen")

    def __init__(self, limit: int = _MAX_RAW_ID_GUARD_LOOKUPS) -> None:
        self._remaining = limit
        self._seen: set[str] = set()

    def reserve(self, raw_id: str) -> bool:
        """Return True when a guard lookup for *raw_id* should run. Returns
        False for a raw id already checked this request (de-dupe). Raises
        ``HTTPException(400)`` once the per-request lookup budget is exhausted."""
        if raw_id in self._seen:
            return False
        if self._remaining <= 0:
            raise HTTPException(
                status_code=400,
                detail="Too many resource identifiers in request.",
            )
        self._remaining -= 1
        self._seen.add(raw_id)
        return True


# ---------------------------------------------------------------------------
# List routes — GET requests that return a paginated {object:"list", data:[…]}
# These are intercepted and served entirely from the DB rather than forwarded
# to the upstream provider, so each caller only sees IDs they own.
# ---------------------------------------------------------------------------

# Maps (provider, canonical_path) -> "files" | "batches"
_LIST_ROUTE_TABLE: Final[dict[tuple[str, str], ResourceKind]] = {
    ("openai", "/v1/files"): "files",
    ("openai", "/v1/batches"): "batches",

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Send at most one managed resource identifier per request; split multi-resource requests into separate calls.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at litellm/proxy/pass_through_endpoints/managed_id_rewriter.py:210 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/b3318018c9d7bce0. Report an issue: GitHub.