{"record":{"id":"252014dafca87797","repo":"sgl-project/sglang","slug":"invalid-reasoning-effort-reasoning-effort-r-for","errorCode":null,"errorMessage":"Invalid reasoning effort {reasoning_effort!r} for profile {reasoning_effort_profile!r}; expected one of {list(effort_prompts)}","messagePattern":"Invalid reasoning effort (.+?) for profile (.+?); expected one of (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/entrypoints/openai/encoding_dsv4.py","lineNumber":323,"sourceCode":"    tool_calls = msg.get(\"tool_calls\")\n    reasoning_content = msg.get(\"reasoning_content\")\n    wo_eos = msg.get(\"wo_eos\", False)\n\n    if tools:\n        tools = tools_from_openai_format(tools)\n    if tool_calls:\n        tool_calls = tool_calls_from_openai_format(tool_calls)\n\n    if reasoning_effort_profile not in REASONING_EFFORT_PROFILES:\n        raise ValueError(\n            f\"Invalid reasoning effort profile: {reasoning_effort_profile!r}; \"\n            f\"expected one of {list(REASONING_EFFORT_PROFILES)}\"\n        )\n    effort_prompts = REASONING_EFFORT_PROFILES[reasoning_effort_profile]\n    if reasoning_effort is None:\n        reasoning_effort = \"low\" if reasoning_effort_profile == \"official\" else \"high\"\n    if reasoning_effort not in effort_prompts:\n        raise ValueError(\n            f\"Invalid reasoning effort {reasoning_effort!r} for profile \"\n            f\"{reasoning_effort_profile!r}; expected one of {list(effort_prompts)}\"\n        )\n    if index == 0 and thinking_mode == \"thinking\":\n        prompt += effort_prompts[reasoning_effort]\n\n    if role == \"system\":\n        prompt += system_msg_template.format(content=content or \"\")\n        if tools:\n            prompt += \"\\n\\n\" + render_tools(tools)\n        if response_format:\n            prompt += \"\\n\\n\" + response_format_template.format(\n                schema=to_json(response_format)\n            )\n\n    elif role == \"developer\":\n        assert content, f\"Invalid message for role `{role}`: {msg}\"\n","sourceCodeStart":305,"sourceCodeEnd":341,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/entrypoints/openai/encoding_dsv4.py#L305-L341","documentation":"The reasoning_effort value is not valid for the chosen profile; each profile in REASONING_EFFORT_PROFILES defines its own effort keys (e.g. low/medium/high) and this combination failed.","triggerScenarios":"reasoning_effort='minimal' with profile 'official', or any effort key not present in effort_prompts for the selected profile.","commonSituations":"Copying effort strings from OpenAI API ('minimal') to a DeepSeek profile that doesn't support it; mixing profile and effort from different versions.","solutions":["Use an effort listed in the error message for that profile (commonly 'low'/'medium'/'high').","Leave reasoning_effort None to accept the profile default ('low' for official, 'high' otherwise).","Align profile and effort values with the deployed model's docs."],"exampleFix":"# before\nencode_messages(msgs, reasoning_effort_profile='official', reasoning_effort='minimal')\n# after\nencode_messages(msgs, reasoning_effort_profile='official', reasoning_effort='low')","handlingStrategy":"validation","validationCode":"assert reasoning_effort in REASONING_EFFORT_PROFILES[reasoning_effort_profile]","typeGuard":"def is_valid_effort(p,e): return e in REASONING_EFFORT_PROFILES.get(p,{})","tryCatchPattern":null,"preventionTips":["Omit reasoning_effort to use the profile default.","Validate profile+effort pairs together."],"tags":["deepseek-v4","reasoning-effort","validation"],"backgroundTag":"invalid-enum-argument","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}