affaan-m/ECC · error · RuntimeError

could not read track

Error message

could not read {kind} track {track}

What it means

_items wraps DaVinci Resolve's timeline.GetItemListInTrack. Resolve returns None when the requested track (kind + index) cannot be read — typically the track does not exist or the API call fails silently. The library converts that into a RuntimeError naming the kind and track index.

Solutions

  1. Check timeline.GetTrackCount(kind) before reading a track index
  2. Fix base_track_count so only existing tracks are probed
  3. Re-acquire the timeline/project object (stale Resolve API handle)
  4. Confirm the Resolve instance is on the Edit page with the project open

Example fix

// before
items = timeline.GetItemListInTrack("video", 5)  # only 3 video tracks
// after
count = timeline.GetTrackCount("video")
if track < count:
    items = timeline.GetItemListInTrack("video", track)
Defensive patterns

Strategy: type-guard

Validate before calling

count = timeline.GetTrackCount(kind)
if not (0 <= track < count):
    raise ValueError(f"{kind} track {track} does not exist (count={count})")

Type guard

def track_exists(timeline, kind: str, track: int) -> bool:
    count = timeline.GetTrackCount(kind)
    return isinstance(count, int) and 0 <= track < count

Try / catch

try:
    items = timeline.GetItemListInTrack(kind, track)
except Exception as exc:
    raise RuntimeError(f"Resolve API failed reading {kind} track {track}: {exc}") from exc

Prevention

When it happens

Trigger: Reading an overlay track index >= GetTrackCount('video') during snapshot/readback; asking for a kind ('video'/'audio') track that was deleted; calling on a timeline object whose API session went stale.

Common situations: base_track_count misconfigured so the script probes non-existent tracks; Resolve project changed between planning and applying; timeline opened without proper project/page context (API returns None instead of raising).

Related errors


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

Appendix: source

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

            (i for i, end in enumerate(ends) if end <= event["record_frame"]), len(ends)
        )
        if index == len(ends):
            ends.append(0)
        ends[index] = event["record_frame"] + event["frames"]
        allocated[event["id"]] = {**event, "track": base_track_count + index + 1}
    return [allocated[event["id"]] for event in checked]


def _path(item):
    media = item.GetMediaPoolItem()
    raw = media.GetClipProperty("File Path") if media else None
    return str(Path(raw).expanduser().resolve()) if raw else None


def _items(timeline, kind, track):
    items = timeline.GetItemListInTrack(kind, track)
    if items is None:
        raise RuntimeError(f"could not read {kind} track {track}")
    return items


def _base_snapshot(timeline, base_track_count):
    snapshot = {}
    for kind, count in [
        ("video", base_track_count),
        ("audio", timeline.GetTrackCount("audio")),
    ]:
        for track in range(1, count + 1):
            snapshot[f"{kind}:{track}"] = [
                {
                    "start": item.GetStart(),
                    "end": item.GetEnd(),
                    "duration": item.GetDuration(),
                    "enabled": item.GetClipEnabled(),
                    "path": _path(item),
                    "properties": copy.deepcopy(item.GetProperty()),

View on GitHub (pinned to 8321021c54)