nexu-io/open-design · error · SystemExit

unknown state(s): {', '.join(unknown)}

Error message

unknown state(s): {', '.join(unknown)}

What it means

parse_states rejects any --states token that is not a key of ROW_FRAME_COUNTS (idle, running-right, running-left, waving, jumping, failed, waiting, running, review). The literal "all" expands to every known state; anything else must match exactly. Unknown tokens are collected, sorted, and reported comma-joined.

Source

Thrown at skills/hatch-pet/scripts/extract_strip_frames.py:35

    "idle": 6,
    "running-right": 8,
    "running-left": 8,
    "waving": 4,
    "jumping": 5,
    "failed": 8,
    "waiting": 6,
    "running": 6,
    "review": 6,
}


def parse_states(raw: str) -> list[str]:
    if raw.strip().lower() == "all":
        return list(ROW_FRAME_COUNTS)
    states = [item.strip() for item in raw.split(",") if item.strip()]
    unknown = sorted(set(states) - set(ROW_FRAME_COUNTS))
    if unknown:
        raise SystemExit(f"unknown state(s): {', '.join(unknown)}")
    return states


def parse_hex_color(value: str) -> tuple[int, int, int]:
    if not re.fullmatch(r"#[0-9a-fA-F]{6}", value):
        raise SystemExit(f"invalid chroma key color: {value}; expected #RRGGBB")
    return tuple(int(value[index : index + 2], 16) for index in (1, 3, 5))


def load_chroma_key(decoded_dir: Path, override: str | None) -> tuple[int, int, int]:
    if override:
        return parse_hex_color(override)
    request_path = decoded_dir.parent / "pet_request.json"
    if request_path.is_file():
        request = json.loads(request_path.read_text(encoding="utf-8"))
        chroma_key = request.get("chroma_key")
        if isinstance(chroma_key, dict) and isinstance(chroma_key.get("hex"), str):
            return parse_hex_color(chroma_key["hex"])

View on GitHub (pinned to 5be4028344)

Solutions

  1. Cross-check the token against the ROW_FRAME_COUNTS keys in extract_strip_frames.py.
  2. Use --states all to process every supported state without listing them.
  3. Fix the typo or remove the unknown token from the comma-separated list.

Example fix

# before
--states idle,runing-right
# after
--states idle,running-right
Defensive patterns

Strategy: validation

Validate before calling

ROW_FRAME_COUNTS = {"idle", "running-right", "running-left", "waving", "jumping", "failed", "waiting", "running", "review"}

raw = "idle,foo"
states = {s.strip() for s in raw.split(",") if s.strip()} if raw.strip().lower() != "all" else ROW_FRAME_COUNTS
unknown = sorted(states - ROW_FRAME_COUNTS)
assert not unknown, f"unknown state(s): {', '.join(unknown)}"

Type guard

def is_known_state(raw: str) -> bool:
    from extract_strip_frames import ROW_FRAME_COUNTS
    return raw.strip().lower() == "all" or all(s.strip() in ROW_FRAME_COUNTS for s in raw.split(","))

Prevention

When it happens

Trigger: Passing --states with a typo (e.g. runing-right), an outdated name, or an unsupported state like foo. Whitespace around tokens is trimmed, but spelling must match exactly.

Common situations: Typos on the command line; copy-pasting state names from stale docs; referencing a state that was renamed or not yet added to ROW_FRAME_COUNTS.

Related errors


AI-assisted analysis of nexu-io/open-design@5be4028344 (2026-08-12). Data as JSON: /api/errors/558339f1a4ab42ac. Report an issue: GitHub.