sgl-project/sglang · error · ValueError
Inkling reasoning_effort must be finite and in [0.0, 0.99]
Error message
Inkling reasoning_effort must be finite and in [0.0, 0.99]
What it means
reasoning_effort must be a finite float within [0.0, 0.99]. NaN, infinity, negative values, or values >= 1.0 raise ValueError. The upper bound 0.99 leaves room for the renderer's own maximum-effort directive.
Source
Thrown at python/sglang/srt/parser/inkling_renderer.py:257
if not isinstance(text, str):
raise TypeError("Inkling thinking part payload must be a string")
yield ("thinking", text)
elif ptype in _IMAGE_PART_TYPES:
yield ("image", "")
elif ptype in _AUDIO_PART_TYPES:
yield ("audio", "")
else:
raise ValueError(f"unsupported content part type: {ptype!r}")
def _format_reasoning_effort(reasoning_effort: float) -> str:
if isinstance(reasoning_effort, bool) or not isinstance(
reasoning_effort, (int, float)
):
raise TypeError("Inkling reasoning_effort must be a number")
value = float(reasoning_effort)
if not math.isfinite(value) or not 0.0 <= value <= 0.99:
raise ValueError("Inkling reasoning_effort must be finite and in [0.0, 0.99]")
return f"{round(value, 2):g}"
def _expect_role(message: Mapping[str, Any]) -> str:
role = message.get("role")
if role not in ROLE_MESSAGE_TOKENS:
raise ValueError(
f"unsupported Inkling message role {role!r}; expected one of {sorted(ROLE_MESSAGE_TOKENS)}"
)
return str(role)
def _as_mapping(value: Any) -> Mapping[str, Any]:
if isinstance(value, Mapping):
return value
if hasattr(value, "model_dump"):
dumped = value.model_dump()
if isinstance(dumped, Mapping):View on GitHub (pinned to 0132848349)
Solutions
- Clamp reasoning_effort to [0.0, 0.99], e.g. min(max(v,0.0),0.99)
- Use 0.99 for maximum effort
Example fix
# before reasoning_effort=1.0 # after reasoning_effort=0.99
Defensive patterns
Strategy: validation
Validate before calling
import math
if effort is not None:
assert math.isfinite(effort) and 0.0 <= effort <= 0.99, effort Prevention
- Clamp: effort = min(max(float(effort), 0.0), 0.99)
- Remember the max is 0.99, not 1.0
When it happens
Trigger: Passing reasoning_effort=1.0, 1.5, -0.1, float('nan'), or float('inf') to append_effort/chat kwargs.
Common situations: Users assuming a 0–1 or 0–100 scale; normalizing 'max' effort to 1.0.
Related errors
- Inkling reasoning_effort must be a number
- H.264 encoder did not return MP4 decoder config
- MXFP8 fused prologue requires head_dim-aligned Q/K/V.
- MXFP8 fused prologue requires K/V scale buffers.
- MXFP8 fused prologue requires interleaved K/V scale buffers
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/3ef740b2d8af4372.
Report an issue: GitHub.