sgl-project/sglang · error · ValueError
Invalid reasoning effort {reasoning_effort!r} for profile {r
Error message
Invalid reasoning effort {reasoning_effort!r} for profile {reasoning_effort_profile!r}; expected one of {list(effort_prompts)} What it means
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.
Source
Thrown at python/sglang/srt/entrypoints/openai/encoding_dsv4.py:323
tool_calls = msg.get("tool_calls")
reasoning_content = msg.get("reasoning_content")
wo_eos = msg.get("wo_eos", False)
if tools:
tools = tools_from_openai_format(tools)
if tool_calls:
tool_calls = tool_calls_from_openai_format(tool_calls)
if reasoning_effort_profile not in REASONING_EFFORT_PROFILES:
raise ValueError(
f"Invalid reasoning effort profile: {reasoning_effort_profile!r}; "
f"expected one of {list(REASONING_EFFORT_PROFILES)}"
)
effort_prompts = REASONING_EFFORT_PROFILES[reasoning_effort_profile]
if reasoning_effort is None:
reasoning_effort = "low" if reasoning_effort_profile == "official" else "high"
if reasoning_effort not in effort_prompts:
raise ValueError(
f"Invalid reasoning effort {reasoning_effort!r} for profile "
f"{reasoning_effort_profile!r}; expected one of {list(effort_prompts)}"
)
if index == 0 and thinking_mode == "thinking":
prompt += effort_prompts[reasoning_effort]
if role == "system":
prompt += system_msg_template.format(content=content or "")
if tools:
prompt += "\n\n" + render_tools(tools)
if response_format:
prompt += "\n\n" + response_format_template.format(
schema=to_json(response_format)
)
elif role == "developer":
assert content, f"Invalid message for role `{role}`: {msg}"
View on GitHub (pinned to 0132848349)
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.
Example fix
# before encode_messages(msgs, reasoning_effort_profile='official', reasoning_effort='minimal') # after encode_messages(msgs, reasoning_effort_profile='official', reasoning_effort='low')
Defensive patterns
Strategy: validation
Validate before calling
assert reasoning_effort in REASONING_EFFORT_PROFILES[reasoning_effort_profile]
Type guard
def is_valid_effort(p,e): return e in REASONING_EFFORT_PROFILES.get(p,{}) Prevention
- Omit reasoning_effort to use the profile default.
- Validate profile+effort pairs together.
When it happens
Trigger: reasoning_effort='minimal' with profile 'official', or any effort key not present in effort_prompts for the selected profile.
Common situations: Copying effort strings from OpenAI API ('minimal') to a DeepSeek profile that doesn't support it; mixing profile and effort from different versions.
Related errors
- Invalid reasoning effort profile: {reasoning_effort_profile!
- v_cache must be provided
- q can only be None when only_qv=True
- q must be provided unless qv is provided with only_qv=True
- `dt_bias` must have {HV * K} elements (got {dt_bias.numel()}
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/252014dafca87797.
Report an issue: GitHub.