sgl-project/sglang · error · ValueError
Invalid reasoning effort profile: {reasoning_effort_profile!
Error message
Invalid reasoning effort profile: {reasoning_effort_profile!r}; expected one of {list(REASONING_EFFORT_PROFILES)} What it means
DSv4 render_message validates reasoning_effort_profile against REASONING_EFFORT_PROFILES; an unknown profile name raises ValueError listing valid options.
Source
Thrown at python/sglang/srt/entrypoints/openai/encoding_dsv4.py:315
prompt = ""
msg = messages[index]
last_user_idx = find_last_user_index(messages)
role = msg.get("role")
content = msg.get("content")
tools = msg.get("tools")
response_format = msg.get("response_format")
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)View on GitHub (pinned to 0132848349)
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.
Example fix
# before encode_messages(msgs, reasoning_effort_profile='fast') # after encode_messages(msgs, reasoning_effort_profile='official')
Defensive patterns
Strategy: validation
Validate before calling
from sglang.srt.entrypoints.openai.encoding_dsv4 import REASONING_EFFORT_PROFILES assert profile in REASONING_EFFORT_PROFILES
Type guard
def is_valid_profile(p): return p in REASONING_EFFORT_PROFILES
Prevention
- Import the profiles dict instead of hardcoding names.
When it happens
Trigger: reasoning_effort_profile set to something not in REASONING_EFFORT_PROFILES (e.g. 'fast', 'default') via the encoding API or mapped server arg.
Common situations: Typos; using profile names from another model family; version mismatch where the profile set changed.
Related errors
- Invalid reasoning effort {reasoning_effort!r} for profile {r
- 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/940888a3cf29d0a8.
Report an issue: GitHub.