sgl-project/sglang · error · ValueError

Unknown Ideogram 4 preset {preset!r}; expected one of {sorte

Error message

Unknown Ideogram 4 preset {preset!r}; expected one of {sorted(IDEOGRAM4_PRESETS)}

What it means

The Ideogram 4 denoising loop looks up a named preset in the IDEOGRAM4_PRESETS table; an unknown preset name is rejected before building the schedule. Presets bundle num_steps and schedule settings, so an invalid name has no valid fallback.

Source

Thrown at python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/ideogram.py:346

        batch.did_sp_shard_latents = False

    def _postprocess_sp_latents(
        self,
        batch: Req,
        latents: torch.Tensor,
        trajectory_tensor: torch.Tensor | None,
    ) -> tuple[torch.Tensor, torch.Tensor | None]:
        return latents, trajectory_tensor

    def verify_input(self, batch: Req, server_args: ServerArgs) -> VerificationResult:
        return VerificationResult()

    def _prepare_denoising_loop(
        self, batch: Req, server_args: ServerArgs
    ) -> DenoisingContext:
        preset = getattr(batch, "preset", "V4_DEFAULT_20")
        if preset not in IDEOGRAM4_PRESETS:
            raise ValueError(
                f"Unknown Ideogram 4 preset {preset!r}; expected one of {sorted(IDEOGRAM4_PRESETS)}"
            )
        preset_cfg = IDEOGRAM4_PRESETS[preset]
        num_steps = int(preset_cfg["num_steps"])
        device = get_local_torch_device()
        schedule = get_schedule_for_resolution(
            (batch.height, batch.width),
            known_mean=float(preset_cfg["mu"]),
            std=float(preset_cfg["std"]),
        )
        step_intervals = make_step_intervals(num_steps).to(device)
        guidance_schedule = torch.as_tensor(
            preset_cfg["guidance_schedule"], dtype=torch.float32, device=device
        )
        schedule_values = schedule(step_intervals)
        schedule_deltas = schedule_values[:-1] - schedule_values[1:]

        self.scheduler.set_timesteps(num_steps, device=device)

View on GitHub (pinned to 0132848349)

Solutions

  1. Check the error message for the sorted list of valid presets and use one of them
  2. Upgrade sglang so the preset table matches what your client sends
  3. Omit preset to fall back to the 'V4_DEFAULT_20' default

Example fix

# before
req.preset = "V4_DEFAULT_2O"  # typo: letter O
# after
from sglang.multimodal_gen.runtime.pipelines_core.stages.model_specific_stages.ideogram import IDEOGRAM4_PRESETS
assert req.preset in IDEOGRAM4_PRESETS, sorted(IDEOGRAM4_PRESETS)
Defensive patterns

Strategy: validation

Validate before calling

from sglang.multimodal_gen.runtime.pipelines_core.stages.model_specific_stages.ideogram import IDEOGRAM4_PRESETS
if preset not in IDEOGRAM4_PRESETS:
    preset = "V4_DEFAULT_20"

Type guard

def is_valid_ideogram_preset(p: str) -> bool:
    return p in IDEOGRAM4_PRESETS

Prevention

When it happens

Trigger: Setting batch.preset (or a request field mapped to it) to a string not in IDEOGRAM4_PRESETS, e.g. 'V4_TURBO' typo or 'V3_DEFAULT_20' from an older API version.

Common situations: Renamed/removed presets between model versions; hand-built Req objects with the default attribute missing so a stale string is passed; client/server version skew where the client knows newer preset names.

Related errors


AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28). Data as JSON: /api/errors/5d5496b8cf162236. Report an issue: GitHub.