affaan-m/ECC · error · ValueError

Output must differ from the original source media

Error message

Output must differ from the original source media

What it means

render() refuses to write output to the same path as the source media: if Path(source).resolve() == Path(output).resolve() it raises ValueError('Output must differ from the original source media'). In-place rendering would destroy the original since output is written via a temp file and then linked over the destination.

Solutions

  1. Pass a distinct output path (different filename or directory)
  2. If editing in place was intended, render to a temp output then replace the original yourself afterward
  3. Normalize both paths with Path.resolve() in scripts that build output names dynamically

Example fix

// before
render('clip.mp4', 0, 'clip.mp4')  # in-place not allowed
// after
render('clip.mp4', 0, 'clip.glitch.mp4')
Defensive patterns

Strategy: validation

Validate before calling

from pathlib import Path
if Path(source).resolve() == Path(output).resolve():
    raise ValueError('output must differ from source')

Try / catch

try:
    render(src, 0, output)
except ValueError as e:
    if 'differ from the original source' in str(e):
        output = Path(src).with_suffix('.glitch' + Path(src).suffix)
        render(src, 0, output)

Prevention

When it happens

Trigger: Calling render('clip.mp4', 0, 'clip.mp4'); passing equivalent paths via different spellings (symlinks, './x', absolute vs relative) that resolve to the same file; constructing output from source with a no-op path join.

Common situations: CLI defaults where output=None falls back to the input path; templated output paths that failed to substitute a filename; users expecting an in-place edit option that does not exist.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


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

Appendix: source

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

    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",
                str(source),
                "-f",
                "rawvideo",
                "-pix_fmt",
                "rgb24",
                "-s",

View on GitHub (pinned to 8321021c54)