affaan-m/ECC · error · ValueError

range must contain two frame integers

Error message

range must contain two frame integers

What it means

Shape guard in _range: a value expected to be a frame range must be a list of exactly two integers (in and out points). The supplied value is not a 2-element list, so clip timing cannot be interpreted.

Solutions

  1. Convert to a two-element list: list(value[:2]) or [start, end]
  2. Ensure both elements are exact ints (see _integer) — convert floats/strings first
  3. Check upstream code for tuples and convert with list(...) before bundle construction

Example fix

// before
clip_range = (100, 200)  # tuple
// after
clip_range = [100, 200]  # list of two ints
Defensive patterns

Strategy: type-guard

Validate before calling

def as_range(v):
    assert isinstance(v, list) and len(v) == 2, f"bad range: {v!r}"
    return [int(v[0]), int(v[1])]

Type guard

def is_frame_range(v) -> bool:
    return isinstance(v, list) and len(v) == 2 and all(type(x) is int for x in v)

Try / catch

try:
    bundle = build_application_bundle(data)
except ValueError as e:
    if "two frame integers" in str(e):
        print("range is not a 2-element int list; convert tuples/normalize shape")
    else:
        raise

Prevention

When it happens

Trigger: Passing a tuple instead of a list, a dict, a single int, or a 3-element list (e.g. [start, end, step]) as source_range/in/out values consumed by _snapshot, _check_clip, _binding, _preserved_stack, or _inserts.

Common situations: Ranges stored as tuples in Python code, JSON that flattened ranges differently, or code that appends a step/stride to range triples.

Understand the failure class

Background: Type mismatch errors: IllegalArgumentException, TypeError and type guards across 150 open-source libraries — this error's family across 150 libraries.

Related errors


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

Appendix: source

Thrown at skills/taste-application/scripts/tasteforge/integration.py:69


def _integer(value: Any, minimum: int = 0) -> int:
    if type(value) is not int or value < minimum:
        raise ValueError("frame/count must be an exact integer in range")
    return value


def _rate(value: Any) -> tuple[int, int]:
    _object(value, {"numerator", "denominator"})
    n, d = (_integer(value[k], 1) for k in ("numerator", "denominator"))
    if math.gcd(n, d) != 1:
        raise ValueError("fps must be a reduced positive rational")
    return n, d


def _range(value: Any, bounds: list[int] | None = None) -> list[int]:
    if not isinstance(value, list) or len(value) != 2:
        raise ValueError("range must contain two frame integers")
    start, end = (_integer(v) for v in value)
    if start >= end or (bounds is not None and (start < bounds[0] or end > bounds[1])):
        raise ValueError("frame range is empty or outside its bounds")
    return value


def _overlap(a: list[int], b: list[int]) -> bool:
    return a[0] < b[1] and b[0] < a[1]


def _sha(value: Any) -> str:
    if not isinstance(value, str) or not re.fullmatch(r"[a-f0-9]{64}", value):
        raise ValueError("resolved SHA-256 required")
    return value


def _identity(info: os.stat_result) -> tuple:
    return (info.st_dev, info.st_ino, info.st_size, info.st_mtime_ns, info.st_ctime_ns)

View on GitHub (pinned to 8321021c54)