affaan-m/ECC · error · ValueError
source capacity does not match native offsets
Error message
source capacity does not match native offsets
What it means
Raised by _binding when the clip's total frame capacity does not equal left_offset + (end - start) + right_offset. The media_frames value in the binding must exactly account for lead-in, body, and tail frames of the native clip.
Solutions
- Set item['media_frames'] = clip['left_offset'] + (clip['end'] - clip['start']) + clip['right_offset'] exactly.
- Regenerate binding metadata from the same snapshot that will be validated against.
- Avoid float-derived frame counts; compute media_frames in integer frames only.
Example fix
// before media_frames = clip['end'] - clip['start'] // after media_frames = clip['left_offset'] + (clip['end'] - clip['start']) + clip['right_offset']
Defensive patterns
Strategy: validation
Validate before calling
for item in bindings:
clip = snapshot['timeline_readback'][item['track']][item['clip_index']]
expected = clip['left_offset'] + (clip['end'] - clip['start']) + clip['right_offset']
assert item['media_frames'] == expected, f"media_frames {item['media_frames']} != {expected}" Type guard
def capacity_matches(item, clip) -> bool:
return item['media_frames'] == clip['left_offset'] + (clip['end'] - clip['start']) + clip['right_offset'] Try / catch
try:
bundle = build_application_bundle(...)
except ValueError as e:
if 'source capacity does not match native offsets' in str(e):
log.error('media_frames vs offsets mismatch', media_frames=item['media_frames'])
raise Prevention
- Compute media_frames from the clip's own offsets, never from trimmed seconds * fps
- Regenerate bindings together with the snapshot after trim changes
- Use integer frame arithmetic exclusively
When it happens
Trigger: item['media_frames'] counts only the trimmed body (end-start) while offsets are nonzero, or the snapshot offsets were edited without updating media_frames.
Common situations: Bindings computed from trimmed source metadata that ignores handles/offsets; snapshot regenerated with changed trim points while binding metadata is stale; rounding when media_frames was derived from seconds * fps.
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
- frame/count must be an exact integer in range
- frame range is empty or outside its bounds
- Missing artifact binding
- range must contain two frame integers
AI-assisted analysis of affaan-m/ECC@8321021c54 (2026-09-16).
Data as JSON: /api/errors/1e8d4358c82ac835.
Report an issue: GitHub.
Appendix: source
Thrown at skills/taste-application/scripts/tasteforge/integration.py:256
def _binding(item: Any, tracks: dict, baseline: dict, *, audio: bool = False) -> tuple:
_object(item, {"media", "track", "clip_index", "media_frames", "fps",
"source_range", "timeline_range"})
track, index = _text(item["track"]), _integer(item["clip_index"])
if not track.startswith("audio" if audio else "video"):
raise ValueError("wrong source/audio track kind")
if track not in tracks or index >= len(tracks[track]):
raise ValueError("source binding has no native clip")
clip = tracks[track][index]
_artifact(item["media"])
if item["media"]["path"] != clip["path"]:
raise ValueError("source path does not match native clip")
if _rate(item["fps"]) != _rate(baseline["fps"]):
raise ValueError("source fps/retime ambiguity")
duration = clip["end"] - clip["start"]
capacity = _integer(item["media_frames"], 1)
if capacity != clip["left_offset"] + duration + clip["right_offset"]:
raise ValueError("source capacity does not match native offsets")
source = _range(item["source_range"], [clip["left_offset"], clip["left_offset"] + duration])
target = _range(item["timeline_range"], [clip["start"], clip["end"]])
mapped = [clip["start"] + f - clip["left_offset"] for f in source]
if mapped != target or (audio and target != [clip["start"], clip["end"]]):
raise ValueError("source/audio placement must preserve native timing")
return track, index
def _preserved_stack(protected: Any, tracks: dict, bounds: list[int]) -> list[dict]:
if not isinstance(protected, list) or not protected:
raise ValueError("protected intervals must be explicit and nonempty")
for item in protected:
_object(item, {"range", "reason"})
_range(item["range"], bounds)
_text(item["reason"])
if not any(_overlap(item["range"], [c["start"], c["end"]])
for key, clips in tracks.items() if key.startswith("video") for c in clips):
raise ValueError("protected interval has no original video stack")View on GitHub (pinned to 8321021c54)