{"record":{"id":"895a3cdcb10c54ef","repo":"BerriAI/litellm","slug":"litellm-ratelimiterror-custom-llm-provider-capit","errorCode":null,"errorMessage":"litellm.RateLimitError: {custom_llm_provider.capitalize()}Exception - {error_str}","messagePattern":"litellm\\.RateLimitError: (.+?)Exception - (.+?)","errorType":"exception","errorClass":"RateLimitError","httpStatus":429,"severity":"error","filePath":"litellm/litellm_core_utils/exception_mapping_utils.py","lineNumber":1258,"sourceCode":"                        url=\"https://cloud.google.com/vertex-ai/\",\n                    ),\n                ),\n            )\n        if original_exception.status_code == 404:\n            raise NotFoundError(\n                message=f\"{custom_llm_provider.capitalize()}Exception - {error_str}\",\n                llm_provider=custom_llm_provider,\n                model=model,\n            )\n        if original_exception.status_code == 408:\n            raise Timeout(\n                message=f\"{custom_llm_provider.capitalize()}Exception - {error_str}\",\n                llm_provider=custom_llm_provider,\n                model=model,\n            )\n\n        if original_exception.status_code == 429:\n            raise RateLimitError(\n                message=f\"litellm.RateLimitError: {custom_llm_provider.capitalize()}Exception - {error_str}\",\n                model=model,\n                llm_provider=custom_llm_provider,\n                litellm_debug_info=extra_information,\n                response=httpx.Response(\n                    status_code=429,\n                    request=httpx.Request(\n                        method=\"POST\",\n                        url=\" https://cloud.google.com/vertex-ai/\",\n                    ),\n                ),\n            )\n        if original_exception.status_code == 500:\n            raise litellm.InternalServerError(\n                message=f\"{custom_llm_provider.capitalize()}Exception InternalServerError - {error_str}\",\n                model=model,\n                llm_provider=custom_llm_provider,\n                litellm_debug_info=extra_information,","sourceCodeStart":1240,"sourceCodeEnd":1276,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/litellm_core_utils/exception_mapping_utils.py#L1240-L1276","documentation":"The status-based rate-limit branch: if the Vertex exception's status_code is exactly 429, LiteLLM raises RateLimitError with a synthetic 429 response and litellm_debug_info attached. This is the straightforward quota/throughput signal (RESOURCE_EXHAUSTED with HTTP 429), distinct from the string-matched quota phrases earlier in the chain. LiteLLM's Router treats it as a cooldown+retry candidate.","triggerScenarios":"vertex_ai completion calls exceeding PerModelPerProject RPM/TPM quota, provisioned-throughput limits, or a fresh project's default low quota — Google returns HTTP 429 and LiteLLM maps it directly.","commonSituations":"Fan-out batch jobs with high parallelism; default quotas on brand-new GCP projects (often single-digit QPM for big models); multi-team shared project quota exhaustion; bursts after a deploy warming up many workers.","solutions":["Retry with exponential backoff honoring Retry-Info: completion(..., num_retries=5) or Router with cooldown_time","Cap concurrency and rate: Router rpm/tpm limits or a client-side limiter under the quota","Request quota increases in GCP (IAM & Admin -> Quotas) for the specific model","Add fallback deployments/regions via Router rate_limit_error_fallbacks"],"exampleFix":"# before\nimport asyncio\nawait asyncio.gather(*[\n    acompletion(model=\"vertex_ai/gemini-1.5-pro\", messages=[m]) for m in many\n])\n# RateLimitError - 429\n\n# after: bounded concurrency + retries\nimport asyncio\nfrom litellm import acompletion\nSEM = asyncio.Semaphore(5)\nasync def one(m):\n    async with SEM:\n        return await acompletion(\n            model=\"vertex_ai/gemini-1.5-pro\", messages=[m], num_retries=5,\n        )\nresults = await asyncio.gather(*[one(m) for m in many])","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"import litellm, asyncio, random\n\nasync def complete_with_backoff(msgs, tries=5):\n    for attempt in range(tries):\n        try:\n            return await litellm.acompletion(model=\"vertex_ai/gemini-1.5-pro\", messages=msgs)\n        except litellm.RateLimitError:\n            await asyncio.sleep(min(2 ** attempt + random.random(), 120))\n    raise litellm.RateLimitError(message=\"exhausted retries\", model=\"x\", llm_provider=\"x\")","preventionTips":["Set client rpm/tpm 10-20% under the GCP quota","Honor retry-after hints from the error body","Provision quota increases ahead of traffic growth, not after 429 pages"],"tags":["litellm","vertex-ai","rate-limit","http-429","quota"],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}