{"record":{"id":"b101e4a83dfa9e33","repo":"BerriAI/litellm","slug":"competitors-list-exceeds-maximum-of-max-competito","errorCode":null,"errorMessage":"competitors list exceeds maximum of {MAX_COMPETITOR_NAMES}","messagePattern":"competitors list exceeds maximum of (.+?)","errorType":"http","errorClass":"HTTPException","httpStatus":400,"severity":"error","filePath":"litellm/proxy/management_endpoints/policy_endpoints/endpoints.py","lineNumber":694,"sourceCode":"\ndef _validate_enrichment_request(data: EnrichTemplateRequest) -> tuple[dict, dict, str]:\n    \"\"\"\n    Validate enrichment request and return (template, llm_enrichment, brand_name).\n\n    Raises HTTPException on validation failure.\n    \"\"\"\n    templates: Final = _load_policy_templates_from_local_backup()\n    template: Final = next((t for t in templates if t.get(\"id\") == data.template_id), None)\n    if template is None:\n        raise HTTPException(status_code=404, detail=f\"Template '{data.template_id}' not found\")\n\n    llm_enrichment: Final = template.get(\"llm_enrichment\")\n    if llm_enrichment is None:\n        raise HTTPException(status_code=400, detail=\"Template does not support LLM enrichment\")\n\n    # Validate competitors list size if provided\n    if data.competitors and len(data.competitors) > MAX_COMPETITOR_NAMES:\n        raise HTTPException(\n            status_code=400,\n            detail=f\"competitors list exceeds maximum of {MAX_COMPETITOR_NAMES}\",\n        )\n\n    brand_name: Final = data.parameters.get(llm_enrichment[\"parameter\"], \"\")\n    if not brand_name:\n        raise HTTPException(\n            status_code=400,\n            detail=f\"Parameter '{llm_enrichment['parameter']}' is required\",\n        )\n\n    return template, llm_enrichment, brand_name\n\n\n@router.post(\n    \"/policy/templates/enrich\",\n    tags=[\"policy management\"],\n    dependencies=[Depends(user_api_key_auth)],","sourceCodeStart":676,"sourceCodeEnd":712,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/management_endpoints/policy_endpoints/endpoints.py#L676-L712","documentation":"Pre-flight validation for LLM template enrichment: the supplied competitors array is longer than the MAX_COMPETITOR_NAMES cap, so the request is rejected with 400 before spending LLM tokens. At-fault input is data.competitors exceeding the configured maximum.","triggerScenarios":"Thrown at litellm/proxy/management_endpoints/policy_endpoints/endpoints.py:694 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Reduce the competitors list to at most the maximum allowed names."],"exampleFix":null,"handlingStrategy":"validation","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-14T00:17:10.932Z"}