affaan-m/ECC · error · ValueError

Invalid concat file entry

Error message

Invalid concat file entry

What it means

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.

Solutions

  1. Quote paths containing spaces in the concat file: file "my video.mp4"
  2. Remove any extra tokens so each 'file' line has exactly two fields
  3. Check for invisible characters or trailing whitespace creating phantom fields (run `cat -A concat.txt`)
  4. Regenerate the concat file programmatically with shlex.quote around each path

Example fix

// before (concat.txt)
file my video.mp4

// after (concat.txt)
file "my video.mp4"
Defensive patterns

Strategy: validation

Validate before calling

import shlex
def concat_lines_ok(path):
    for i, line in enumerate(Path(path).read_text().splitlines(), 1):
        fields = shlex.split(line, comments=True)
        if fields and fields[0] == 'file' and len(fields) != 2:
            raise ValueError(f'concat line {i} must be: file <single path>')

Try / catch

try:
    files = read_concat('concat.txt')
except ValueError as e:
    print(f'Fix concat manifest: {e}')
    sys.exit(2)

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.

Related errors


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

Appendix: source

Thrown at skills/taste-application/scripts/tasteforge/media/capcut.py:39

            "-of",
            "csv=p=0",
            str(path),
        ],
        check=True,
        capture_output=True,
        text=True,
    )
    return float(result.stdout.strip())


def read_concat(path):
    path = Path(path).resolve()
    files = []
    for line in path.read_text().splitlines():
        fields = shlex.split(line, comments=True)
        if fields and fields[0] == "file":
            if len(fields) != 2:
                raise ValueError("Invalid concat file entry")
            files.append((path.parent / fields[1]).resolve())
    return files


def export_draft(
    files,
    drafts,
    name,
    width=1920,
    height=1080,
    fps=30,
    overwrite=False,
    cc=None,
    probe=duration_of,
):
    geometry(width, height, fps)
    if overwrite:
        raise ValueError("CapCut draft replacement is unsafe; choose a new name")

View on GitHub (pinned to 8321021c54)