affaan-m/ECC · error · ValueError

insert overlaps protected original stack

Error message

insert overlaps protected original stack

What it means

An insert's target timeline_range must not overlap any protected interval from the config. Protected intervals mark regions where original footage must remain untouched; inserting generated footage there would violate that guarantee, so _inserts rejects the proposal.

Solutions

  1. Move the insert's timeline_range outside all protected intervals, or shrink it to avoid overlap
  2. Remove the conflicting protected interval if protection is no longer needed there (and rebuild the bundle)
  3. Recompute the insert layout programmatically from the protected intervals so ranges never collide

Example fix

// before
protected: [4000, 4800]; insert timeline_range: [4600, 5400]
// after
insert timeline_range: [4800, 5600]  // starts after protected interval
Defensive patterns

Strategy: validation

Validate before calling

function assertNoProtectedOverlap(inserts, protectedIntervals) {
  for (const ins of inserts) {
    for (const p of protectedIntervals) {
      if (ins.timeline_range[0] < p.range[1] && p.range[0] < ins.timeline_range[1])
        throw new Error(`insert ${ins.candidate_id} overlaps protected range`);
    }
  }
}

Try / catch

try {
  buildApplicationBundle(cfg);
} catch (e) {
  if (e.message.includes("insert overlaps protected original stack")) {
    cfg.inserts = relocateOutsideProtected(cfg.inserts, cfg.protected_intervals);
    return buildApplicationBundle(cfg);
  }
  throw e;
}

Prevention

When it happens

Trigger: An insert proposal whose timeline_range [start, end] intersects one of config['protected_intervals'] ranges. Happens when the insert plan was made before protection marks were added, or ranges were nudged after retiming.

Common situations: User protects a region after insert proposals were drafted; off-by-one or unit mistakes (seconds vs frames) making ranges appear to overlap; overlapping-by-a-single-frame boundary conditions.

Understand the failure class

Background: Conflicting config options: "cannot be used together" — configuration validation errors across open-source libraries — this error's family across 162 libraries.

Related errors


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

Appendix: source

Thrown at skills/taste-application/scripts/tasteforge/integration.py:320

        expected = {"source_sha256": source_hash, "compiled_input_sha256": input_hash,
                    "candidate_sha256": item["media"]["sha256"], "source_url": source_url}
        if any(evidence.get(key) != value for key, value in expected.items()):
            raise ValueError("historical evidence does not bind the candidate source/input/bytes")
        result[name] = item
    return result


def _inserts(items: list, candidates: dict, config: dict, input_hash: str, edit_hash: str) -> None:
    occupied = []
    for item in items:
        _object(item, {"candidate_id", "candidate_range", "timeline_range", "retime", "approval_file"})
        candidate = candidates.get(_text(item["candidate_id"]))
        if candidate is None or candidate["review_status"] != "approved":
            raise ValueError("insert requires an approved, resolved candidate")
        target = _range(item["timeline_range"], config["baseline"]["timeline_range"])
        source = _range(item["candidate_range"], [0, candidate["media_frames"]])
        if any(_overlap(target, p["range"]) for p in config["protected_intervals"]):
            raise ValueError("insert overlaps protected original stack")
        if any(_overlap(target, span) for span in occupied):
            raise ValueError("insert proposals overlap")
        if (item["retime"] != "none" or target[1] - target[0] != source[1] - source[0]
                or _rate(candidate["fps"]) != _rate(config["baseline"]["fps"])):
            raise ValueError("candidate fps/duration/retime ambiguity")
        evidence = _artifact(item["approval_file"], parse_json=True)
        expected = {"status": "approved", "candidate_sha256": candidate["media"]["sha256"],
                    "source_sha256": config["source"]["media"]["sha256"],
                    "compiled_input_sha256": input_hash,
                    "edit_context_sha256": edit_hash,
                    "candidate_range": source, "timeline_range": target}
        if not isinstance(evidence, dict) or any(
                _canonical(evidence.get(key)) != _canonical(value) for key, value in expected.items()):
            raise ValueError("approval evidence must bind exact source, candidate and placement")
        occupied.append(target)


def build_application_bundle(config: dict, compiled_input: dict | None, *, local_only: bool = False) -> dict:

View on GitHub (pinned to 8321021c54)