affaan-m/ECC · error · ValueError

unknown timeline format

Error message

unknown timeline format {fmt!r} - use 'fcpxml' or 'edl'

What it means

timeline.py raises ValueError('unknown timeline format {fmt!r} - use fcpxml or edl') in write_timeline when the fmt argument (after lowercasing and stripping a leading dot) is not 'fcpxml' or 'edl'. The writer supports exactly two output formats.

Solutions

  1. Pass fmt='fcpxml' or fmt='edl' exactly.
  2. Strip any accidental suffix/whitespace: fmt.strip().lower().lstrip('.') before calling.
  3. Derive fmt from the output file extension only if it maps to one of the two supported values.
  4. Update config to use a supported format name.

Example fix

// before
write_timeline(clips, out, fmt='premiere')
// after
write_timeline(clips, out, fmt='fcpxml')  # or 'edl'
Defensive patterns

Strategy: validation

Validate before calling

ALLOWED_FORMATS = {'fcpxml', 'edl'}
def validate_format(fmt):
    f = str(fmt).lower().lstrip('.').strip()
    if f not in ALLOWED_FORMATS:
        raise ValueError(f"unknown timeline format {fmt!r} - use 'fcpxml' or 'edl'")
    return f

Type guard

def is_supported_format(fmt) -> bool:
    return str(fmt).lower().lstrip('.').strip() in {'fcpxml', 'edl'}

Try / catch

try:
    write_timeline(clips, out, fmt=fmt)
except ValueError as e:
    if 'unknown timeline format' in str(e):
        logger.error('unsupported format %r; defaulting to fcpxml', fmt)
        write_timeline(clips, out, fmt='fcpxml')

Prevention

When it happens

Trigger: Calling write_timeline with fmt like 'xml', 'fcp', '.FCPXML' handled okay but 'premiere', 'fcpxml.txt', or a mistyped string; fmt=None coerced by str() elsewhere; passing an extension with extra characters.

Common situations: User config specifying a format name not in the supported pair; passing a filename where the format string was expected; case variants handled, but hyphenated variants ('fcp-xml') are not.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


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

Appendix: source

Thrown at skills/taste-application/scripts/taste/timeline.py:449

    fps: float,
    out_path: str | Path,
    fmt: str = "fcpxml",
    title: str | None = None,
    width: int = 1920,
    height: int = 1080,
) -> Path:
    """Write ``clips`` to ``out_path`` as ``fcpxml`` or ``edl``. Returns the path."""
    out_path = Path(out_path)
    out_path.parent.mkdir(parents=True, exist_ok=True)
    name = title or out_path.stem

    fmt = fmt.lower().lstrip(".")
    if fmt == "fcpxml":
        text = build_fcpxml(clips, fps=fps, title=name, width=width, height=height)
    elif fmt == "edl":
        text = build_edl(clips, fps=fps, title=name)
    else:
        raise ValueError(f"unknown timeline format {fmt!r} - use 'fcpxml' or 'edl'")

    out_path.write_text(text, encoding="utf-8")
    return out_path


# ---------------------------------------------------------------------------
# self-check
# ---------------------------------------------------------------------------

if __name__ == "__main__":
    import tempfile

    # --- rational arithmetic, the part that breaks imports when wrong --------
    assert fps_fraction(29.97) == Fraction(30000, 1001)
    assert fps_fraction(23.976) == Fraction(24000, 1001)
    assert fps_fraction(24) == Fraction(24, 1)
    assert frames_to_rational(1, 29.97) == "1001/30000s", frames_to_rational(1, 29.97)
    assert frames_to_rational(0, 24) == "0s"

View on GitHub (pinned to 8321021c54)