affaan-m/ECC · error · ValueError

Start must be finite and nonnegative

Error message

Start must be finite and nonnegative

What it means

render() validates its arguments before doing any work. The start timestamp must be a finite (not NaN/inf) and non-negative number of seconds. It raises ValueError('Start must be finite and nonnegative') otherwise, failing fast instead of producing a nonsensical ffmpeg seek command.

Solutions

  1. Pass a plain non-negative float/int for start
  2. Clamp or validate the value before calling: max(0.0, start)
  3. Fix the upstream calculation that produces the timestamp (check for NaN from missing data)
  4. If input is user/config supplied, parse and validate it as a finite number first

Example fix

// before
start = float(config.get('start'))  # NaN if missing
render(src, start, ...)
// after
start = float(config.get('start', 0.0))
if not math.isfinite(start) or start < 0: start = 0.0
render(src, start, ...)
Defensive patterns

Strategy: validation

Validate before calling

import math
if not isinstance(start, (int, float)) or not math.isfinite(start) or start < 0:
    raise ValueError('start must be a finite nonnegative number')

Type guard

def is_valid_start(v) -> bool:
    return isinstance(v, (int, float)) and not isinstance(v, bool) and math.isfinite(v) and v >= 0

Try / catch

try:
    render(src, start, out)
except ValueError as e:
    if 'Start must be' in str(e):
        start = 0.0
        render(src, start, out)

Prevention

When it happens

Trigger: Passing start=float('nan'), float('inf'), or a negative number to render(); passing a value parsed from unvalidated config/CLI input.

Common situations: Parsing timestamps from external data where NaN slipped in (e.g. float('nan') from a JSON config or empty field converted to float); subtracting timestamps and getting a negative offset; a computation like (end-start) returning -0.000001 due to floating point.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


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

Appendix: source

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

        raise RuntimeError("Decoder produced no frames")
    return n


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",

View on GitHub (pinned to 8321021c54)