affaan-m/ECC · error · ValueError

Unknown effect mode

Error message

Unknown effect mode

What it means

render() only supports the effect modes 'drift', 'feedback', 'pixelsort', and 'mosh'. Any other mode string raises ValueError('Unknown effect mode'). This is a closed enum validated before any subprocess work.

Solutions

  1. Use one of the supported modes: 'drift', 'feedback', 'pixelsort', 'mosh'
  2. Check spelling against the accepted tuple in render()
  3. Validate/normalize user-supplied mode against the whitelist before calling render()
  4. Check the library version if a mode you expected is missing — it may not exist in this release

Example fix

// before
render(src, 0, out, mode='datamosh')
// after
render(src, 0, out, mode='mosh')
Defensive patterns

Strategy: validation

Validate before calling

VALID_MODES = {'drift','feedback','pixelsort','mosh'}
if mode not in VALID_MODES:
    raise ValueError(f'mode must be one of {sorted(VALID_MODES)}')

Type guard

def is_valid_mode(mode) -> bool:
    return mode in ('drift', 'feedback', 'pixelsort', 'mosh')

Try / catch

try:
    render(src, 0, out, mode=mode)
except ValueError as e:
    if 'Unknown effect mode' in str(e):
        print(f'{mode!r} unsupported; use drift|feedback|pixelsort|mosh')

Prevention

When it happens

Trigger: Passing mode='glitch', mode='datamosh', a typo like 'pixsort', or None/empty string to render(); wiring mode from an unvalidated CLI flag or config value.

Common situations: Typo in the mode string; copying mode names from a different tool's docs; passing the enum from an incompatible version of the library; forwarding user input without whitelisting.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


AI-assisted analysis of affaan-m/ECC@8321021c54 (2026-09-16). Data as JSON: /api/errors/53054ce8f461a058. Report an issue: GitHub.

Appendix: source

Thrown at skills/taste-application/scripts/tasteforge/media/glitch.py:116


def render(
    source,
    start,
    duration,
    output,
    seed,
    mode="drift",
    width=1920,
    height=1080,
    fps=30,
    overwrite=False,
):
    geometry(width, height, fps, duration)
    if not math.isfinite(start) or start < 0:
        raise ValueError("Start must be finite and nonnegative")
    if mode not in ("drift", "feedback", "pixelsort", "mosh"):
        raise ValueError("Unknown effect mode")
    if not Path(source).is_file():
        raise FileNotFoundError(source)
    if isinstance(seed, bool) or not isinstance(seed, int) or seed < 0:
        raise ValueError("Seed must be a nonnegative integer")
    if Path(source).resolve() == Path(output).resolve():
        raise ValueError("Output must differ from the original source media")
    with output_file(output, overwrite) as temporary:
        dec = subprocess.Popen(
            [
                "ffmpeg",
                "-nostdin",
                "-v",
                "error",
                "-ss",
                str(start),
                "-t",
                str(duration),
                "-i",

View on GitHub (pinned to 8321021c54)