affaan-m/ECC · error · RuntimeError

could not import

Error message

could not import {event['asset']}

What it means

For each planned event, apply_placements imports the asset file into the media pool via media_pool.ImportMedia([asset]) and requires exactly one imported MediaPoolItem back. If the import fails (empty result, None, or more than one item), it raises this RuntimeError naming the asset path. Import typically fails when the file path is invalid or unsupported by Resolve.

Solutions

  1. Verify the asset file exists and is an absolute path before calling apply_placements (os.path.isfile).
  2. Pre-import the assets into the media pool and confirm Resolve can open them in the UI.
  3. Re-render or restore the missing overlay file, then re-run.

Example fix

// before
apply_placements(tl, pool, placements, ...)
// after
missing = [e["asset"] for e in placements if not os.path.isfile(e["asset"])]
if missing:
    raise FileNotFoundError(missing)
apply_placements(tl, pool, placements, ...)
Defensive patterns

Strategy: validation

Validate before calling

missing = [e["asset"] for e in placements if not os.path.isabs(e["asset"]) or not os.path.isfile(e["asset"])]
if missing:
    raise FileNotFoundError(f"assets missing for import: {missing}")

Type guard

def importable_assets(placements):
    import os
    return all(
        isinstance(e.get("asset"), str)
        and os.path.isabs(e["asset"])
        and os.path.isfile(e["asset"])
        for e in placements
    )

Try / catch

try:
    apply_placements(tl, pool, placements, ...)
except RuntimeError as e:
    if "could not import" in str(e):
        asset = str(e).split("could not import ", 1)[1]
        print(f"check existence/codec of {asset} and re-render if needed")
    else:
        raise

Prevention

When it happens

Trigger: event['asset'] points to a file that does not exist, has an unsupported codec/container, lies outside the project's media storage, or the path is a relative path that Resolve cannot resolve from the scripting host.

Common situations: Renders not yet finished when the script runs (overlay file missing); assets moved/renamed after planning; network share unmounted; unsupported formats like some ProRes variants on certain OS builds.

Understand the failure class

Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.

Related errors


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

Appendix: source

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

    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(
            [
                {
                    "mediaPoolItem": imported[0],
                    "startFrame": 0,
                    "endFrame": event["frames"] - (source_end_mode == "inclusive"),
                    "mediaType": 1,
                    "trackIndex": event["track"],
                    "recordFrame": event["record_frame"],
                }
            ]
        )
        if not items or len(items) != 1:
            raise RuntimeError(f"could not append {event['id']}")
        item = items[0]
        for key, value in [
            ("Opacity", event["opacity"]),
            ("CompositeMode", event["composite"]),

View on GitHub (pinned to 8321021c54)