affaan-m/ECC · error · ValueError

apply_local produced an invalid report

Error message

apply_local produced an invalid report: {problems}

What it means

Before returning, apply_local validates its own generated report against APPLICATION_REPORT_SCHEMA using schema.validate. If any problems are found, it raises ValueError — an internal invariant violation meaning the report builder and the schema are out of sync, not that user input was wrong.

Solutions

  1. Read the problems list in the message; update the report construction in apply_local to satisfy the schema.
  2. If the report is intentionally new, update APPLICATION_REPORT_SCHEMA to match.
  3. Reinstall/align the package so apply.py and schema.py come from the same version.
  4. Run the library's test suite for apply_local after any schema/report change.

Example fix

// before (report adds 'notes' but schema lacks it)
problems = schema.validate(report, schema.APPLICATION_REPORT_SCHEMA)

// after (schema.py)
APPLICATION_REPORT_SCHEMA = {
    ...,
    "notes": {"type": "list", "required": False},
}
Defensive patterns

Strategy: try-catch

Try / catch

try:
    report = apply_local(sp, media=clips)
except ValueError as e:
    if "invalid report" in str(e):
        logging.critical(f"library bug, report schema mismatch: {e}")
        raise  # do not retry; report/repair the package version
    raise

Prevention

When it happens

Trigger: Any apply_local call whose internally built report fails schema validation — typically after modifying the report-building code without updating APPLICATION_REPORT_SCHEMA, or vice versa (version mismatch between modules).

Common situations: Patching apply.py's report fields (renaming/adding keys) while the schema still expects the old shape; a mixed install where schema.py and apply.py come from different versions; a plugin or subclass altering the report.

Understand the failure class

Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.

Related errors


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

Appendix: source

Thrown at skills/taste-application/scripts/tasteforge/apply.py:234

        "media": [
            {"path": str(c.get("path")), "duration": float(c.get("duration") or 0)}
            for c in validated_media
        ],
        "planned_shots": shots,
        "timeline_events": events,
        "cadence": {
            "mean_shot": cadence.get("mean_shot", 0.0),
            "rhythm_variance": cadence.get("rhythm_variance", 0.0),
            "cuts_per_min": cadence.get("cuts_per_min", 0.0),
        },
        "notes": [
            "shot durations drawn from the pack's measured cadence (seeded, "
            "deterministic); no provider generation was requested or run",
        ],
    }
    problems = schema.validate(report, schema.APPLICATION_REPORT_SCHEMA)
    if problems:
        raise ValueError(f"apply_local produced an invalid report: {problems}")
    return report


def apply_generate(
    sp: pack_mod.StylePack, brief: str, **_: Any
) -> dict[str, Any]:
    """Refuse provider generation. Fails closed, always."""
    raise ProviderDisabledError(_FAIL_CLOSED)

View on GitHub (pinned to 8321021c54)