sgl-project/sglang · error · ValueError

action string is empty

Error message

action string is empty

What it means

Raised by parse_sana_wm_action_string when, after removing all whitespace and normalizing full-width commas to ASCII commas, the action string is empty. The parser expects comma-separated segments like '<keys>-<frames>'.

Source

Thrown at python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/sana_wm/base.py:123

    allow_none: bool = False,
    error_label: str = "camera_actions",
) -> list[list[str]]:
    if payload is None and allow_none:
        return []
    if not isinstance(payload, list):
        raise ValueError(f"{error_label} must be list[list[str]]")
    out: list[list[str]] = []
    for frame_actions in payload:
        if not isinstance(frame_actions, list):
            raise ValueError(f"{error_label} must be list[list[str]]")
        out.append([str(key).lower() for key in frame_actions])
    return out


def parse_sana_wm_action_string(action: str) -> list[list[str]]:
    cleaned = "".join(action.replace(",", ",").split())
    if not cleaned:
        raise ValueError("action string is empty")

    per_frame: list[list[str]] = []
    for segment in cleaned.split(","):
        if not segment or "-" not in segment:
            raise ValueError(
                f"invalid action segment {segment!r}; expected '<keys>-<frames>'"
            )
        keys_part, duration = segment.rsplit("-", 1)
        if not duration.isdigit() or int(duration) <= 0:
            raise ValueError(f"invalid duration in action segment {segment!r}")

        if keys_part.lower() == "none":
            keys: list[str] = []
        else:
            bad = sorted(
                {
                    char
                    for char in keys_part.lower()

View on GitHub (pinned to 0132848349)

Solutions

  1. Supply a non-empty action string such as 'none-8' or 'ab-4,none-4'
  2. Treat empty/missing action as 'none-<num_frames>' if a default is desired
  3. Guard upstream: if not action.strip(): use default

Example fix

// before
action = request.camera_actions or ''
// after
action = request.camera_actions or f'none-{num_frames}'
Defensive patterns

Strategy: fallback

Validate before calling

action = (action or '').strip() or f'none-{num_frames}'

Type guard

def is_parseable_action(s: str) -> bool:
    return bool(''.join(s.replace(',', ',').split()))

Prevention

When it happens

Trigger: Calling parse_sana_wm_action_string('') , ' ', or a string of only commas/whitespace (e.g. ' , , '). Reached via on_init, ingest_event, sana_wm_action_to_camera_to_world_array, and _action_num_frames_for_request.

Common situations: Passing an empty camera_actions string from request config; user prompt produced no action tokens; upstream defaulted the field to '' instead of None.

Related errors


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