affaan-m/ECC · error · FileNotFoundError

FileNotFoundError(source)

Error message

FileNotFoundError(source)

What it means

render() checks Path(source).is_file() before spawning ffmpeg and raises FileNotFoundError(source) if the source path does not exist or is not a regular file. It fails fast instead of letting ffmpeg produce a confusing decoder failure.

Solutions

  1. Verify the path exists: os.path.isfile(source) before calling render
  2. Print/resolve the absolute path (Path(source).resolve()) to spot wrong working-directory assumptions
  3. Fix the upstream step that should have produced the source file
  4. Check for typos or extension mismatches in the filename

Example fix

// before
render('vid.mp4', 0, out)  # file actually at ./media/vid.mp4
// after
src = Path('media/vid.mp4')
assert src.is_file(), f'missing source: {src.resolve()}'
render(src, 0, out)
Defensive patterns

Strategy: validation

Validate before calling

from pathlib import Path
src_path = Path(source)
if not src_path.is_file():
    raise FileNotFoundError(f'source missing: {src_path.resolve()}')

Try / catch

try:
    render(source, 0, out)
except FileNotFoundError as e:
    print(f'source not found: {e}; cwd={os.getcwd()}')

Prevention

When it happens

Trigger: Passing a non-existent path to render(); the source being a directory or special device; a relative path that resolves differently from the working directory; upstream pipeline failing to produce the source before render runs.

Common situations: Wrong working directory when running a script; path built from unvalidated user input; source deleted between download and render; symlink to a missing target.

Understand the failure class

Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.

Related errors


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

Appendix: source

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

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",
                str(source),
                "-f",

View on GitHub (pinned to 8321021c54)