{"record":{"id":"15100372c0b1df82","repo":"sgl-project/sglang","slug":"thinking-display-is-not-allowed-when-thinking-type","errorCode":null,"errorMessage":"thinking.display is not allowed when thinking.type is 'disabled'","messagePattern":"thinking\\.display is not allowed when thinking\\.type is 'disabled'","errorType":"validation","errorClass":"ValueError","httpStatus":400,"severity":"error","filePath":"python/sglang/srt/entrypoints/anthropic/protocol.py","lineNumber":302,"sourceCode":"        if self.type == \"enabled\":\n            if self.budget_tokens is None:\n                raise ValueError(\n                    \"thinking.budget_tokens is required when \"\n                    \"thinking.type is 'enabled'\"\n                )\n            if self.budget_tokens < 1024:\n                raise ValueError(\n                    \"thinking.budget_tokens must be >= 1024 \"\n                    \"(got {})\".format(self.budget_tokens)\n                )\n        elif self.type == \"disabled\":\n            if self.budget_tokens is not None:\n                raise ValueError(\n                    \"thinking.budget_tokens is not allowed when \"\n                    \"thinking.type is 'disabled'\"\n                )\n            if self.display is not None:\n                raise ValueError(\n                    \"thinking.display is not allowed when \"\n                    \"thinking.type is 'disabled'\"\n                )\n        elif self.type == \"adaptive\":\n            if self.budget_tokens is not None:\n                raise ValueError(\n                    \"thinking.budget_tokens is not allowed when \"\n                    \"thinking.type is 'adaptive'\"\n                )\n        return self\n\n\nclass AnthropicTaskBudget(BaseModel):\n    \"\"\"Claude 4.7 ``output_config.task_budget`` — soft hint, not a hard cap.\n\n    Mirrors ``BetaTokenTaskBudgetParam`` in the Anthropic SDK: ``total``\n    and ``type`` are required; ``remaining`` is the client-tracked\n    countdown used for compaction. The hard cap on generation is still","sourceCodeStart":284,"sourceCodeEnd":320,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/entrypoints/anthropic/protocol.py#L284-L320","documentation":"Raised by the Anthropic-compatible endpoint's validator when thinking.type='disabled' but a thinking.display field is present. Display configuration only applies to enabled thinking, so mixing it with 'disabled' is rejected as a 400.","triggerScenarios":"POST /v1/messages with {\"thinking\": {\"type\": \"disabled\", \"display\": true}} (or any non-null display value).","commonSituations":"Reusing a full thinking config dict and only flipping type to 'disabled'; SDK defaults that populate display; migrating configs between API versions where display was newly added.","solutions":["Remove the display field when thinking.type is 'disabled'","Set display to null/None","Keep thinking only as {\"type\": \"disabled\"} when disabling"],"exampleFix":"// before\n{\"thinking\": {\"type\": \"disabled\", \"display\": true}}\n// after\n{\"thinking\": {\"type\": \"disabled\"}}","handlingStrategy":"validation","validationCode":"if thinking[\"type\"] == \"disabled\":\n    thinking = {\"type\": \"disabled\"}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Whitelist fields per thinking type","Strip display when disabling"],"tags":["anthropic","thinking","display","validation","request-validation"],"backgroundTag":"request-validation-failed","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}