affaan-m/ECC · error · ValueError
frame range is empty or outside its bounds
Error message
frame range is empty or outside its bounds
What it means
After structural checks, _range enforces semantic validity: start must be strictly less than end, and if bounds are supplied the range must lie fully inside them; violations raise ValueError('frame range is empty or outside its bounds'). Zero-length or inverted ranges and out-of-bounds clips are rejected.
Solutions
- Ensure end > start for every range and that ranges fit within the snapshot's frame bounds
- Fix off-by-one math (range end is exclusive) and recompute from actual clip lengths
- Clamp or drop clips whose ranges fall outside the media duration before building the bundle
Example fix
// before
clip = {"range": [0, 9999]} # exceeds 240-frame snapshot
// after
clip = {"range": [0, min(9999, snapshot_duration_frames)]} Defensive patterns
Strategy: validation
Validate before calling
def valid_range(r, bounds):
return r[0] < r[1] and bounds[0] <= r[0] and r[1] <= bounds[1]
assert valid_range(clip_range, [0, duration_frames]), "range empty or out of bounds" Try / catch
try:
bundle = build_application_bundle(data)
except ValueError as e:
if "empty or outside its bounds" in str(e):
print("clip range is zero-length, inverted, or exceeds media duration")
else:
raise Prevention
- Compute end frames with a consistent exclusive-end convention
- Clamp ranges to the snapshot/media duration before bundling
- Drop or flag zero-length clips before they reach the bundle builder
When it happens
Trigger: Passing [100, 100] (empty), [200, 100] (inverted), or a range extending past the snapshot duration, e.g. [0, 9999] against bounds [0, 240].
Common situations: Off-by-one errors when computing end frames (exclusive vs inclusive end), clips trimmed to zero length, and ranges copied between sources with different total durations.
Understand the failure class
Background: "value must be between 0 and 1" / "out of range" / "must not be negative" errors: fixing range-validation failures across open-source libraries — this error's family across 42 libraries.
Related errors
- asset contains too few frames
- Canonical session snapshot requires
- frame/count must be an exact integer in range
- minimum win rate must be between 0 and 1
- range must contain two frame integers
AI-assisted analysis of affaan-m/ECC@8321021c54 (2026-09-16).
Data as JSON: /api/errors/da7a6d44a1b2564c.
Report an issue: GitHub.
Appendix: source
Thrown at skills/taste-application/scripts/tasteforge/integration.py:72
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)
def _artifact(record: Any, *, parse_json: bool = False) -> Any:View on GitHub (pinned to 8321021c54)