{"record":{"id":"f6316737a67b86aa","repo":"affaan-m/ECC","slug":"invalid-concat-file-entry","errorCode":null,"errorMessage":"Invalid concat file entry","messagePattern":"Invalid concat file entry","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"skills/taste-application/scripts/tasteforge/media/capcut.py","lineNumber":39,"sourceCode":"            \"-of\",\n            \"csv=p=0\",\n            str(path),\n        ],\n        check=True,\n        capture_output=True,\n        text=True,\n    )\n    return float(result.stdout.strip())\n\n\ndef read_concat(path):\n    path = Path(path).resolve()\n    files = []\n    for line in path.read_text().splitlines():\n        fields = shlex.split(line, comments=True)\n        if fields and fields[0] == \"file\":\n            if len(fields) != 2:\n                raise ValueError(\"Invalid concat file entry\")\n            files.append((path.parent / fields[1]).resolve())\n    return files\n\n\ndef export_draft(\n    files,\n    drafts,\n    name,\n    width=1920,\n    height=1080,\n    fps=30,\n    overwrite=False,\n    cc=None,\n    probe=duration_of,\n):\n    geometry(width, height, fps)\n    if overwrite:\n        raise ValueError(\"CapCut draft replacement is unsafe; choose a new name\")","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/affaan-m/ECC/blob/8321021c54d670126ce3b2969d5deb880b4b0c2a/skills/taste-application/scripts/tasteforge/media/capcut.py#L21-L57","documentation":"read_concat parses an ffmpeg-style concat file where each non-comment line must be exactly 'file <path>'. Any 'file' line with a different number of shell-split fields (extra tokens, unquoted spaces, missing path) is rejected. This prevents silently building a clip list from malformed manifests.","triggerScenarios":"A concat file line like `file my video.mp4` (unquoted space yields 3 fields), `file` with no path, or `file a.mp4 extra.txt`; also using a field count other than 2 on any 'file' line.","commonSituations":"Hand-written concat manifests with unquoted filenames containing spaces; files exported by tools that append metadata columns; copy-pasting lines with trailing arguments; paths not quoted per shlex conventions.","solutions":["Quote paths containing spaces in the concat file: file \"my video.mp4\"","Remove any extra tokens so each 'file' line has exactly two fields","Check for invisible characters or trailing whitespace creating phantom fields (run `cat -A concat.txt`)","Regenerate the concat file programmatically with shlex.quote around each path"],"exampleFix":"// before (concat.txt)\nfile my video.mp4\n\n// after (concat.txt)\nfile \"my video.mp4\"","handlingStrategy":"validation","validationCode":"import shlex\ndef concat_lines_ok(path):\n    for i, line in enumerate(Path(path).read_text().splitlines(), 1):\n        fields = shlex.split(line, comments=True)\n        if fields and fields[0] == 'file' and len(fields) != 2:\n            raise ValueError(f'concat line {i} must be: file <single path>')","typeGuard":null,"tryCatchPattern":"try:\n    files = read_concat('concat.txt')\nexcept ValueError as e:\n    print(f'Fix concat manifest: {e}')\n    sys.exit(2)","preventionTips":["Generate concat files programmatically with shlex.quote(path)","Quote any path containing spaces in the manifest","Validate the manifest with shlex before feeding it to the tool","Avoid hand-editing concat files; use sed-like tools that preserve quoting"],"tags":["python","ffmpeg","concat","parsing"],"backgroundTag":"invalid-argument-format","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"}