affaan-m/ECC · error · ValueError

base_track_count exceeds target video tracks

Error message

base_track_count exceeds target video tracks

What it means

After the fps check, apply_placements verifies the target timeline already has at least base_track_count video tracks. base_track_count is the number of tracks reserved for the base edit; if the target timeline has fewer video tracks than that, the function cannot preserve the base layer and raises before mutating. The caller is expected to supply a target built with the same track layout as the source.

Solutions

  1. Duplicate the source timeline as the target so it inherits the full video track count, then clear overlay tracks.
  2. Add video tracks to the target until GetTrackCount('video') >= base_track_count before calling apply_placements.
  3. Lower base_track_count to the actual number of base tracks present on the target.

Example fix

// before
apply_placements(new_blank_tl, pool, placements, base_track_count=3, ...)
// after
target = src_tl.CreateDuplicateTimeline("v2")
apply_placements(target, pool, placements, base_track_count=3, ...)
Defensive patterns

Strategy: validation

Validate before calling

count = timeline.GetTrackCount("video")
if count < base_track_count:
    raise ValueError(f"target has {count} video tracks, need {base_track_count}")

Type guard

def has_enough_video_tracks(timeline, base_track_count):
    try:
        return timeline.GetTrackCount("video") >= base_track_count
    except (AttributeError, TypeError):
        return False

Try / catch

try:
    apply_placements(tl, pool, placements, base_track_count=n, ...)
except ValueError as e:
    if "exceeds target video tracks" in str(e):
        while tl.GetTrackCount("video") < n:
            tl.AddTrack("video")
        apply_placements(tl, pool, placements, base_track_count=n, ...)
    else:
        raise

Prevention

When it happens

Trigger: Calling apply_placements(timeline, ..., base_track_count=4) on a freshly created Resolve timeline that has only 1 video track, or on a timeline whose video track count was reduced by the user.

Common situations: Creating the versioned target timeline via Resolve's default 'new timeline' (1 video track) while the source timeline has several base tracks; pointing apply at a blank timeline to 'start fresh'.

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


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

Appendix: source

Thrown at skills/taste-application/scripts/tasteforge/resolve.py:264

    media pool. Existing overlay tracks must be empty; base tracks are preserved.
    source_end_mode is required: use the endpoint convention verified on this
    Resolve host. No automatic retry occurs if that convention is incorrect.
    """
    if source_end_mode not in ("inclusive", "exclusive"):
        raise ValueError("source_end_mode must be inclusive or exclusive")
    if not isinstance(source_timeline, str) or not source_timeline:
        raise ValueError("source_timeline must be explicit")
    name = timeline.GetName()
    if not name or name == source_timeline:
        raise ValueError("target must be a distinct versioned timeline")
    plan = allocate_placements(
        placements, fps=fps, base_track_count=base_track_count, probe=probe
    )
    if _fps(timeline.GetSetting("timelineFrameRate")) != _fps(fps):
        raise ValueError("target timeline fps mismatch")
    count = timeline.GetTrackCount("video")
    if count < base_track_count:
        raise ValueError("base_track_count exceeds target video tracks")
    for track in range(base_track_count + 1, count + 1):
        if _items(timeline, "video", track):
            raise ValueError("target overlay tracks must be empty")
    before = _base_snapshot(timeline, base_track_count)
    for _ in range(count, max(event["track"] for event in plan)):
        old_count = timeline.GetTrackCount("video")
        if (
            not timeline.AddTrack("video")
            or timeline.GetTrackCount("video") != old_count + 1
        ):
            raise RuntimeError("could not create overlay track")
    appended = []
    for event in plan:
        imported = media_pool.ImportMedia([event["asset"]])
        if not imported or len(imported) != 1:
            raise RuntimeError(f"could not import {event['asset']}")
        items = media_pool.AppendToTimeline(
            [

View on GitHub (pinned to 8321021c54)