{"record":{"id":"0ecf8aca0f88d258","repo":"BerriAI/litellm","slug":"limit-must-be-non-negative","errorCode":null,"errorMessage":"limit must be non-negative","messagePattern":"limit must be non-negative","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/integrations/focus/database.py","lineNumber":57,"sourceCode":"            query_params.append(start_time_utc)\n            placeholder_index += 1\n        if end_time_utc:\n            where_clauses.append(f\"dus.updated_at <= ${placeholder_index}::timestamptz\")\n            query_params.append(end_time_utc)\n            placeholder_index += 1\n\n        where_clause = \"\"\n        if where_clauses:\n            where_clause = \"WHERE \" + \" AND \".join(where_clauses)\n\n        limit_clause = \"\"\n        if limit is not None:\n            try:\n                limit_value: Final = int(limit)\n            except (TypeError, ValueError) as exc:  # pragma: no cover - defensive guard\n                raise ValueError(\"limit must be an integer\") from exc\n            if limit_value < 0:\n                raise ValueError(\"limit must be non-negative\")\n            limit_clause = f\" LIMIT ${placeholder_index}\"\n            query_params.append(limit_value)\n\n        query: Final = f\"\"\"\n        SELECT\n            dus.id,\n            dus.date,\n            dus.user_id,\n            dus.api_key,\n            dus.model,\n            dus.model_group,\n            dus.custom_llm_provider,\n            dus.prompt_tokens,\n            dus.completion_tokens,\n            dus.spend,\n            dus.api_requests,\n            dus.successful_requests,\n            dus.failed_requests,","sourceCodeStart":39,"sourceCodeEnd":75,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/integrations/focus/database.py#L39-L75","documentation":"Error \"limit must be non-negative\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/integrations/focus/database.py:57 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass a non-negative limit."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}