{"record":{"id":"70c8e59f9b1918d8","repo":"affaan-m/ECC","slug":"could-not-read-kind-track-track","errorCode":null,"errorMessage":"could not read {kind} track {track}","messagePattern":"could not read (.+?) track (.+?)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"skills/taste-application/scripts/tasteforge/resolve.py","lineNumber":165,"sourceCode":"            (i for i, end in enumerate(ends) if end <= event[\"record_frame\"]), len(ends)\n        )\n        if index == len(ends):\n            ends.append(0)\n        ends[index] = event[\"record_frame\"] + event[\"frames\"]\n        allocated[event[\"id\"]] = {**event, \"track\": base_track_count + index + 1}\n    return [allocated[event[\"id\"]] for event in checked]\n\n\ndef _path(item):\n    media = item.GetMediaPoolItem()\n    raw = media.GetClipProperty(\"File Path\") if media else None\n    return str(Path(raw).expanduser().resolve()) if raw else None\n\n\ndef _items(timeline, kind, track):\n    items = timeline.GetItemListInTrack(kind, track)\n    if items is None:\n        raise RuntimeError(f\"could not read {kind} track {track}\")\n    return items\n\n\ndef _base_snapshot(timeline, base_track_count):\n    snapshot = {}\n    for kind, count in [\n        (\"video\", base_track_count),\n        (\"audio\", timeline.GetTrackCount(\"audio\")),\n    ]:\n        for track in range(1, count + 1):\n            snapshot[f\"{kind}:{track}\"] = [\n                {\n                    \"start\": item.GetStart(),\n                    \"end\": item.GetEnd(),\n                    \"duration\": item.GetDuration(),\n                    \"enabled\": item.GetClipEnabled(),\n                    \"path\": _path(item),\n                    \"properties\": copy.deepcopy(item.GetProperty()),","sourceCodeStart":147,"sourceCodeEnd":183,"githubUrl":"https://github.com/affaan-m/ECC/blob/8321021c54d670126ce3b2969d5deb880b4b0c2a/skills/taste-application/scripts/tasteforge/resolve.py#L147-L183","documentation":"_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.","triggerScenarios":"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.","commonSituations":"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).","solutions":["Check timeline.GetTrackCount(kind) before reading a track index","Fix base_track_count so only existing tracks are probed","Re-acquire the timeline/project object (stale Resolve API handle)","Confirm the Resolve instance is on the Edit page with the project open"],"exampleFix":"// before\nitems = timeline.GetItemListInTrack(\"video\", 5)  # only 3 video tracks\n// after\ncount = timeline.GetTrackCount(\"video\")\nif track < count:\n    items = timeline.GetItemListInTrack(\"video\", track)","handlingStrategy":"type-guard","validationCode":"count = timeline.GetTrackCount(kind)\nif not (0 <= track < count):\n    raise ValueError(f\"{kind} track {track} does not exist (count={count})\")","typeGuard":"def track_exists(timeline, kind: str, track: int) -> bool:\n    count = timeline.GetTrackCount(kind)\n    return isinstance(count, int) and 0 <= track < count","tryCatchPattern":"try:\n    items = timeline.GetItemListInTrack(kind, track)\nexcept Exception as exc:\n    raise RuntimeError(f\"Resolve API failed reading {kind} track {track}: {exc}\") from exc","preventionTips":["Always check GetTrackCount before indexing a track","Fix base_track_count to match the actual timeline","Re-acquire project/timeline handles after long waits","Keep Resolve on the Edit page with the correct project open during automation"],"tags":["resolve-api","timeline","track"],"backgroundTag":"unexpected-response-shape","analyzedSha":"8321021c54d670126ce3b2969d5deb880b4b0c2a","analyzedAt":"2026-09-16T10:08:13.343Z","contentChangedAt":"2026-09-16T10:08:13.343Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}