{"record":{"id":"940888a3cf29d0a8","repo":"sgl-project/sglang","slug":"invalid-reasoning-effort-profile-reasoning-effor","errorCode":null,"errorMessage":"Invalid reasoning effort profile: {reasoning_effort_profile!r}; expected one of {list(REASONING_EFFORT_PROFILES)}","messagePattern":"Invalid reasoning effort profile: (.+?); expected one of (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/entrypoints/openai/encoding_dsv4.py","lineNumber":315,"sourceCode":"    prompt = \"\"\n    msg = messages[index]\n    last_user_idx = find_last_user_index(messages)\n\n    role = msg.get(\"role\")\n    content = msg.get(\"content\")\n    tools = msg.get(\"tools\")\n    response_format = msg.get(\"response_format\")\n    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)","sourceCodeStart":297,"sourceCodeEnd":333,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/entrypoints/openai/encoding_dsv4.py#L297-L333","documentation":"DSv4 render_message validates reasoning_effort_profile against REASONING_EFFORT_PROFILES; an unknown profile name raises ValueError listing valid options.","triggerScenarios":"reasoning_effort_profile set to something not in REASONING_EFFORT_PROFILES (e.g. 'fast', 'default') via the encoding API or mapped server arg.","commonSituations":"Typos; using profile names from another model family; version mismatch where the profile set changed.","solutions":["Use one of the listed profiles (e.g. 'official' or others printed in the message).","Print list(REASONING_EFFORT_PROFILES) / check the installed encoding_dsv4.py for valid names.","Upgrade sglang to pick up new profiles."],"exampleFix":"# before\nencode_messages(msgs, reasoning_effort_profile='fast')\n# after\nencode_messages(msgs, reasoning_effort_profile='official')","handlingStrategy":"validation","validationCode":"from sglang.srt.entrypoints.openai.encoding_dsv4 import REASONING_EFFORT_PROFILES\nassert profile in REASONING_EFFORT_PROFILES","typeGuard":"def is_valid_profile(p): return p in REASONING_EFFORT_PROFILES","tryCatchPattern":null,"preventionTips":["Import the profiles dict instead of hardcoding names."],"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"}