{"record":{"id":"5af0f86c37eeb6cc","repo":"BerriAI/litellm","slug":"this-is-a-mock-context-window-exceeded-error","errorCode":null,"errorMessage":"this is a mock context window exceeded error","messagePattern":"this is a mock context window exceeded error","errorType":"http","errorClass":"ContextWindowExceededError","httpStatus":400,"severity":"error","filePath":"litellm/llms/anthropic/experimental_pass_through/messages/utils.py","lineNumber":80,"sourceCode":"    **kwargs,\n) -> AnthropicMessagesResponse:\n    \"\"\"\n    Mock response for Anthropic messages\n    \"\"\"\n    from litellm.exceptions import (\n        ContextWindowExceededError,\n        InternalServerError,\n        RateLimitError,\n    )\n\n    if mock_response == \"litellm.InternalServerError\":\n        raise InternalServerError(\n            message=\"this is a mock internal server error\",\n            llm_provider=\"anthropic\",\n            model=model,\n        )\n    elif mock_response == \"litellm.ContextWindowExceededError\":\n        raise ContextWindowExceededError(\n            message=\"this is a mock context window exceeded error\",\n            llm_provider=\"anthropic\",\n            model=model,\n        )\n    elif mock_response == \"litellm.RateLimitError\":\n        raise RateLimitError(\n            message=\"this is a mock rate limit error\",\n            llm_provider=\"anthropic\",\n            model=model,\n        )\n    return AnthropicMessagesResponse(\n        **{\n            \"content\": [{\"text\": mock_response, \"type\": \"text\"}],\n            \"id\": \"msg_013Zva2CMHLNnXjNJJKqJ2EF\",\n            \"model\": \"claude-sonnet-4-20250514\",\n            \"role\": \"assistant\",\n            \"stop_reason\": \"end_turn\",\n            \"stop_sequence\": None,","sourceCodeStart":62,"sourceCodeEnd":98,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/llms/anthropic/experimental_pass_through/messages/utils.py#L62-L98","documentation":"Error \"this is a mock context window exceeded error\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/llms/anthropic/experimental_pass_through/messages/utils.py:80 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["This is a test/mock error raised intentionally; remove the mock trigger from your request or test setup."],"exampleFix":null,"handlingStrategy":null,"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-14T05:17:10.506Z"}