{"record":{"id":"5e5dd362bb2b14cc","repo":"affaan-m/ECC","slug":"unexpected-overlay-items-after-append","errorCode":null,"errorMessage":"unexpected overlay items after append","messagePattern":"unexpected overlay items after append","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"skills/taste-application/scripts/tasteforge/resolve.py","lineNumber":328,"sourceCode":"                \"asset\": event[\"asset\"],\n                \"requested\": {\n                    key: event[key]\n                    for key in (\n                        \"record_frame\",\n                        \"frames\",\n                        \"track\",\n                        \"opacity\",\n                        \"composite\",\n                    )\n                },\n                \"actual\": actual,\n            }\n        )\n    for track in range(base_track_count + 1, timeline.GetTrackCount(\"video\") + 1):\n        if len(_items(timeline, \"video\", track)) != sum(\n            e[\"track\"] == track for e in plan\n        ):\n            raise RuntimeError(\"unexpected overlay items after append\")\n    if before != _base_snapshot(timeline, base_track_count):\n        raise RuntimeError(\"base tracks changed during overlay placement\")\n    return {\n        \"timeline\": name,\n        \"source_timeline\": source_timeline,\n        \"source_end_mode\": source_end_mode,\n        \"base_track_count\": base_track_count,\n        \"fps\": float(_fps(fps)),\n        \"placements\": receipts,\n        \"preservation\": {\"base_tracks_match\": True},\n    }\n","sourceCodeStart":310,"sourceCodeEnd":340,"githubUrl":"https://github.com/affaan-m/ECC/blob/8321021c54d670126ce3b2969d5deb880b4b0c2a/skills/taste-application/scripts/tasteforge/resolve.py#L310-L340","documentation":"As a final integrity check, apply_placements counts timeline items on every overlay video track and requires the count to equal exactly the number of planned events assigned to that track. Any extra or missing item means Resolve appended something unexpected (or an append silently split/duplicated), so it raises this RuntimeError. Like the base-snapshot check, it protects against silent corruption from Resolve API quirks.","triggerScenarios":"Resolve placing a clip on a different track than trackIndex requested, AppendToTimeline splitting media into multiple items (multi-track source files), or leftover clips on an overlay track that passed the earlier emptiness check due to a race.","commonSituations":"Appending stereo/multi-stream sources that Resolve splits across items; concurrent edits by a human while the script runs; Resolve versions where trackIndex in AppendToTimeline is ignored and clips land on the lowest empty track.","solutions":["Undo/rollback the run (timeline was duplicated for this purpose) and inspect where clips actually landed.","Prefer single-stream overlay media or pre-trim sources so one import equals one item.","Check your Resolve version's AppendToTimeline trackIndex support; add tracks/tracks-empty preconditions manually if needed."],"exampleFix":"// before\n# trust AppendToTimeline trackIndex\n// after\nassert all(len(tl.GetItemListInTrack(\"video\", t)) == expected[t]\n           for t in range(base+1, tl.GetTrackCount(\"video\")+1))","handlingStrategy":"try-catch","validationCode":"for t in range(base + 1, tl.GetTrackCount(\"video\") + 1):\n    print(t, len(tl.GetItemListInTrack(\"video\", t)))  # inspect before final run","typeGuard":"def track_counts_match(plan, timeline, base):\n    return all(\n        len(timeline.GetItemListInTrack(\"video\", t))\n        == sum(e[\"track\"] == t for e in plan)\n        for t in range(base + 1, timeline.GetTrackCount(\"video\") + 1)\n    )","tryCatchPattern":"try:\n    receipt = apply_placements(tl, pool, placements, ...)\nexcept RuntimeError as e:\n    if \"unexpected overlay items\" in str(e):\n        print(\"rollback: discard this duplicate timeline and re-run on a fresh copy\")\n    else:\n        raise","preventionTips":["Use single-stream/single-track media for overlays so one append = one item.","Run apply on a private duplicate timeline so failures can be discarded cheaply.","Avoid concurrent editing of the timeline while the script runs."],"tags":["resolve","integrity","timeline","runtime"],"backgroundTag":"internal-invariant-violation","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"}