{"record":{"id":"f73905100b5d3500","repo":"affaan-m/ECC","slug":"apply-local-produced-an-invalid-report-problems","errorCode":null,"errorMessage":"apply_local produced an invalid report: {problems}","messagePattern":"apply_local produced an invalid report: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"skills/taste-application/scripts/tasteforge/apply.py","lineNumber":234,"sourceCode":"        \"media\": [\n            {\"path\": str(c.get(\"path\")), \"duration\": float(c.get(\"duration\") or 0)}\n            for c in validated_media\n        ],\n        \"planned_shots\": shots,\n        \"timeline_events\": events,\n        \"cadence\": {\n            \"mean_shot\": cadence.get(\"mean_shot\", 0.0),\n            \"rhythm_variance\": cadence.get(\"rhythm_variance\", 0.0),\n            \"cuts_per_min\": cadence.get(\"cuts_per_min\", 0.0),\n        },\n        \"notes\": [\n            \"shot durations drawn from the pack's measured cadence (seeded, \"\n            \"deterministic); no provider generation was requested or run\",\n        ],\n    }\n    problems = schema.validate(report, schema.APPLICATION_REPORT_SCHEMA)\n    if problems:\n        raise ValueError(f\"apply_local produced an invalid report: {problems}\")\n    return report\n\n\ndef apply_generate(\n    sp: pack_mod.StylePack, brief: str, **_: Any\n) -> dict[str, Any]:\n    \"\"\"Refuse provider generation. Fails closed, always.\"\"\"\n    raise ProviderDisabledError(_FAIL_CLOSED)\n","sourceCodeStart":216,"sourceCodeEnd":243,"githubUrl":"https://github.com/affaan-m/ECC/blob/8321021c54d670126ce3b2969d5deb880b4b0c2a/skills/taste-application/scripts/tasteforge/apply.py#L216-L243","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Read the problems list in the message; update the report construction in apply_local to satisfy the schema.","If the report is intentionally new, update APPLICATION_REPORT_SCHEMA to match.","Reinstall/align the package so apply.py and schema.py come from the same version.","Run the library's test suite for apply_local after any schema/report change."],"exampleFix":"// before (report adds 'notes' but schema lacks it)\nproblems = schema.validate(report, schema.APPLICATION_REPORT_SCHEMA)\n\n// after (schema.py)\nAPPLICATION_REPORT_SCHEMA = {\n    ...,\n    \"notes\": {\"type\": \"list\", \"required\": False},\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    report = apply_local(sp, media=clips)\nexcept ValueError as e:\n    if \"invalid report\" in str(e):\n        logging.critical(f\"library bug, report schema mismatch: {e}\")\n        raise  # do not retry; report/repair the package version\n    raise","preventionTips":["Keep apply.py and schema.py on the same package version.","Run the library's tests after patching report fields.","Update schema and report construction in the same change."],"tags":["internal-error","schema","invariant-violation"],"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"}