{"record":{"id":"251da2a6f69af0d9","repo":"affaan-m/ECC","slug":"output-must-differ-from-the-original-source-media","errorCode":null,"errorMessage":"Output must differ from the original source media","messagePattern":"Output must differ from the original source media","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"skills/taste-application/scripts/tasteforge/media/glitch.py","lineNumber":122,"sourceCode":"    output,\n    seed,\n    mode=\"drift\",\n    width=1920,\n    height=1080,\n    fps=30,\n    overwrite=False,\n):\n    geometry(width, height, fps, duration)\n    if not math.isfinite(start) or start < 0:\n        raise ValueError(\"Start must be finite and nonnegative\")\n    if mode not in (\"drift\", \"feedback\", \"pixelsort\", \"mosh\"):\n        raise ValueError(\"Unknown effect mode\")\n    if not Path(source).is_file():\n        raise FileNotFoundError(source)\n    if isinstance(seed, bool) or not isinstance(seed, int) or seed < 0:\n        raise ValueError(\"Seed must be a nonnegative integer\")\n    if Path(source).resolve() == Path(output).resolve():\n        raise ValueError(\"Output must differ from the original source media\")\n    with output_file(output, overwrite) as temporary:\n        dec = subprocess.Popen(\n            [\n                \"ffmpeg\",\n                \"-nostdin\",\n                \"-v\",\n                \"error\",\n                \"-ss\",\n                str(start),\n                \"-t\",\n                str(duration),\n                \"-i\",\n                str(source),\n                \"-f\",\n                \"rawvideo\",\n                \"-pix_fmt\",\n                \"rgb24\",\n                \"-s\",","sourceCodeStart":104,"sourceCodeEnd":140,"githubUrl":"https://github.com/affaan-m/ECC/blob/8321021c54d670126ce3b2969d5deb880b4b0c2a/skills/taste-application/scripts/tasteforge/media/glitch.py#L104-L140","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Pass a distinct output path (different filename or directory)","If editing in place was intended, render to a temp output then replace the original yourself afterward","Normalize both paths with Path.resolve() in scripts that build output names dynamically"],"exampleFix":"// before\nrender('clip.mp4', 0, 'clip.mp4')  # in-place not allowed\n// after\nrender('clip.mp4', 0, 'clip.glitch.mp4')","handlingStrategy":"validation","validationCode":"from pathlib import Path\nif Path(source).resolve() == Path(output).resolve():\n    raise ValueError('output must differ from source')","typeGuard":null,"tryCatchPattern":"try:\n    render(src, 0, output)\nexcept ValueError as e:\n    if 'differ from the original source' in str(e):\n        output = Path(src).with_suffix('.glitch' + Path(src).suffix)\n        render(src, 0, output)","preventionTips":["Derive output names with a distinct suffix or directory, never from source unchanged","Resolve and compare paths before rendering in scripts","Never default output to the input path in CLI wrappers","Render to a temp file then rename if in-place replacement is truly desired"],"tags":["validation","filesystem","media"],"backgroundTag":"invalid-argument-value","analyzedSha":"8321021c54d670126ce3b2969d5deb880b4b0c2a","analyzedAt":"2026-09-16T10:08:13.343Z","contentChangedAt":"2026-09-16T10:08:13.343Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}