{"record":{"id":"8c478dcbcf538e9f","repo":"affaan-m/ECC","slug":"no-readable-references-nothing-to-mint-8c478d","errorCode":null,"errorMessage":"no readable references - nothing to mint","messagePattern":"no readable references - nothing to mint","errorType":"console","errorClass":"SystemExit","httpStatus":null,"severity":"error","filePath":"skills/taste-distillation/scripts/mint.py","lineNumber":86,"sourceCode":"            pooled_pixels.append(np.concatenate([f.reshape(-1, 3) for f in fr]))\n            noise_frames.extend(fr[:8])\n\n        pooled_frames.append(fr)\n\n        c = cad_mod.detect(ref_path)\n        cadences.append(c)\n        print(f\"      {c.n_shots} shots, mean {c.mean_shot:.2f}s, {c.cuts_per_min:.0f} cuts/min\")\n\n        # Stills come from the longest shots of each reference, spread across\n        # the whole set rather than taken from whichever ref happens to be first.\n        ts = cad_mod.keyframe_timestamps(c, limit=max(1, max_stills // max(1, len(refs))))\n        wrote = frame_mod.export_stills(ref_path, sp.stills_dir, ts, prefix=ref_id)\n        print(f\"      {len(wrote)} stills\")\n\n        sp.add_ref(ref_id, str(ref_path), c.total_duration, c.n_shots)\n\n    if not pooled_pixels:\n        raise SystemExit(\"no readable references - nothing to mint\")\n\n    print(\"  analyzing grade across pooled frames ...\")\n    stacked = np.concatenate(pooled_pixels, axis=0)\n    g = grade_mod.analyze_pixels(stacked, noise_frames=noise_frames)\n    merged = cad_mod.merge(cadences)\n\n    print(f\"  baking {lut_size}^3 LUT ...\")\n    cube = grade_mod.bake_cube(g, size=lut_size, strength=strength, title=genre)\n    grade_mod.write_cube(sp.lut_path, cube)\n\n    # Overlay plates - the composable assets, as distinct from the stills,\n    # which only ever condition the generator.\n    plate_frames = []\n    for pix in pooled_frames[:3]:\n        plate_frames.extend(pix)\n    plate_dir = sp.dir / \"plates\"\n    made = plate_mod.mint_plates(plate_frames, plate_dir, noise_sigma=g.noise_sigma)\n    print(f\"  minted {len(made)} overlay plate(s) -> {plate_dir}\")","sourceCodeStart":68,"sourceCodeEnd":104,"githubUrl":"https://github.com/affaan-m/ECC/blob/8321021c54d670126ce3b2969d5deb880b4b0c2a/skills/taste-distillation/scripts/mint.py#L68-L104","documentation":"mint() accumulates pooled pixel arrays and cadence data from each readable reference video. If none of the references yielded readable frames (pooled_pixels is empty), it raises SystemExit('no readable references - nothing to mint'), since grading and cadence analysis require at least one decodable frame.","triggerScenarios":"mint() loops over references calling frame_mod.export_stills; every reference fails to decode (missing file, corrupt/unsupported codec, unreadable path), so pooled_pixels stays empty and the raise fires after the loop.","commonSituations":"Reference videos are corrupt, zero-byte, or in a codec OpenCV/ffmpeg build cannot decode; reference paths are wrong or files were moved; running in a container without video codecs; all refs point at audio-only files.","solutions":["Verify each reference path exists and is a non-empty, decodable video (ffprobe each file).","Re-transcode problem references to a standard codec: ffmpeg -i in.mov -c:v libx264 -pix_fmt yuv420p out.mp4.","Install ffmpeg/codec support (e.g. opencv-python with ffmpeg, not a headless build without codecs) in the environment.","Update the reference manifest/paths if the files were moved or renamed.","Add logging in the reference loop to see per-file export failures and skip/replace bad refs."],"exampleFix":"// before\nrefs = [\"refs/a.mov\", \"refs/b.mov\"]  # both unreadable\n\n// after\nfor r in refs:\n    if not Path(r).exists() or Path(r).stat().st_size == 0:\n        raise SystemExit(f\"bad reference: {r}\")\nsubprocess.run([\"ffmpeg\", \"-v\", \"error\", \"-i\", r, \"-f\", \"null\", \"-\"], check=True)  # sanity decode","handlingStrategy":"validation","validationCode":"import subprocess\nfor ref in refs:\n    r = subprocess.run([\"ffprobe\", \"-v\", \"error\", ref], capture_output=True)\n    if r.returncode != 0:\n        raise SystemExit(f\"unreadable reference: {ref}: {r.stderr.decode()[:200]}\")","typeGuard":"def is_readable_video(path) -> bool:\n    from pathlib import Path\n    p = Path(path)\n    return p.is_file() and p.stat().st_size > 0","tryCatchPattern":"try:\n    mint(refs, out_dir)\nexcept SystemExit as exc:\n    if \"no readable references\" in str(exc):\n        log.error(\"all references failed to decode; check codecs/paths: %s\", refs)\n    raise","preventionTips":["ffprobe/decode-test every reference before minting","Normalize references to H.264/yuv420p MP4 on ingest","Install an OpenCV build with ffmpeg codec support","Fail fast with per-file errors inside the reference loop instead of at the end","Check reference file sizes are non-zero after any copy/transfer"],"tags":["video","ffmpeg","missing-input","decoding"],"backgroundTag":"empty-result-set","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"}