{"record":{"id":"df11238923e5c21c","repo":"BerriAI/litellm","slug":"context-window-size-must-be-non-negative","errorCode":null,"errorMessage":"context_window_size must be non-negative","messagePattern":"context_window_size must be non-negative","errorType":"http","errorClass":"ProxyException","httpStatus":400,"severity":"error","filePath":"litellm/proxy/management_endpoints/model_management_endpoints.py","lineNumber":2244,"sourceCode":") -> AutoRouterClassifierDefaultPromptResponse:\n    \"\"\"\n    Get the default classifier system prompt, so the dashboard's prompt editor can prefill it.\n\n    The prompt's closing line depends on whether prior conversation turns are quoted to the\n    classifier, its tier bullets are named by the router's tier_labels, and its calibration examples\n    come from the router's classification rubric, so the caller passes all three to get the text that router\n    would actually send rather than a rubric it does not use.\n\n    Parameters:\n    - context_window_size: int - The router's classifier_context_window_size. Defaults to the\n      built-in default.\n    - tier_labels: str | None - The router's tier_labels as a JSON object of canonical tier name to\n      display name, e.g. `{\"SIMPLE\": \"Cheap\"}`. Omit or pass an empty object for the default names.\n    - classification_rubric: ClassificationRubric | None - The router's\n      classifier_llm_config.classification_rubric. Omit for the default.\n    \"\"\"\n    if context_window_size < 0:\n        raise ProxyException(\n            message=\"context_window_size must be non-negative\",\n            type=ProxyErrorTypes.bad_request_error,\n            code=status.HTTP_400_BAD_REQUEST,\n            param=\"context_window_size\",\n        )\n\n    labeled_tiers: Final = _labeled_tiers_from_query(tier_labels)\n    return AutoRouterClassifierDefaultPromptResponse(\n        system_prompt=(\n            classification_system_prompt(context_window_size, classification_rubric=classification_rubric)\n            if labeled_tiers is None\n            else classification_system_prompt(\n                context_window_size, labeled_tiers=labeled_tiers, classification_rubric=classification_rubric\n            )\n        )\n    )\n\n","sourceCodeStart":2226,"sourceCodeEnd":2262,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/management_endpoints/model_management_endpoints.py#L2226-L2262","documentation":"Range guard on the auto-router classifier default-prompt endpoint: the context_window_size query parameter was negative. It feeds the classifier prompt's sizing, so only non-negative values are accepted.","triggerScenarios":"Thrown at litellm/proxy/management_endpoints/model_management_endpoints.py:2244 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set context_window_size to a non-negative integer."],"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"}