{"record":{"id":"414b52e324e53071","repo":"calesthio/OpenMontage","slug":"schema-not-found-path","errorCode":null,"errorMessage":"Schema not found: {path}","messagePattern":"Schema not found: (.+?)","errorType":"exception","errorClass":"FileNotFoundError","httpStatus":null,"severity":"error","filePath":"schemas/artifacts/__init__.py","lineNumber":41,"sourceCode":"    \"asset_manifest\",\n    \"edit_decisions\",\n    \"render_report\",\n    \"publish_log\",\n    \"review\",\n    \"cost_log\",\n    \"decision_log\",\n    \"source_media_review\",\n    \"final_review\",\n    \"character_qa_report\",\n    \"video_analysis_brief\",\n]\n\n\ndef load_schema(name: str) -> dict:\n    \"\"\"Load a JSON schema by artifact name.\"\"\"\n    path = SCHEMA_DIR / f\"{name}.schema.json\"\n    if not path.exists():\n        raise FileNotFoundError(f\"Schema not found: {path}\")\n    with open(path, encoding=\"utf-8\") as f:\n        return json.load(f)\n\n\ndef validate_artifact(name: str, data: dict[str, Any]) -> None:\n    \"\"\"Validate artifact data against its schema. Raises on failure.\"\"\"\n    schema = load_schema(name)\n    jsonschema.validate(instance=data, schema=schema)\n\n\ndef list_schemas() -> list[str]:\n    \"\"\"List all available artifact schema names.\"\"\"\n    return [p.stem.replace(\".schema\", \"\") for p in SCHEMA_DIR.glob(\"*.schema.json\")]\n","sourceCodeStart":23,"sourceCodeEnd":55,"githubUrl":"https://github.com/calesthio/OpenMontage/blob/95e1c3d0ab93482159818560f6a8c8e866b9139f/schemas/artifacts/__init__.py#L23-L55","documentation":"Raised by schemas/artifacts/__init__.py's load_schema() when no {name}.schema.json exists in SCHEMA_DIR. Artifact schemas are resolved strictly by filename inside the schemas directory; the module also exports a fixed list of known artifact names (decision_log, source_media_review, final_review, character_qa_report, video_analysis_brief, and others). A miss means the artifact name is unknown or the schema file was not packaged.","triggerScenarios":"Calling validate_artifact(name, data) or load_schema(name) with a typo'd, renamed, or unregistered artifact name; a packaging/checkout that omitted the .schema.json files; using a new artifact type before its schema was added.","commonSituations":"Typos and wrong casing in artifact names; artifact renamed between versions; the schemas directory missing in an installed package (data files not included in the wheel/manifest).","solutions":["Call list_schemas() and use an exact returned name.","If the schema should exist, verify SCHEMA_DIR contains {name}.schema.json in your checkout/install.","If packaging dropped the files, include package data (*.schema.json) in the build config."],"exampleFix":"# before\nvalidate_artifact(\"DecisionLog\", data)  # FileNotFoundError\n\n# after\nfrom schemas.artifacts import list_schemas, validate_artifact\nprint(list_schemas())\nvalidate_artifact(\"decision_log\", data)","handlingStrategy":"validation","validationCode":"from schemas.artifacts import list_schemas\n\navailable = set(list_schemas())\nif artifact_name not in available:\n    raise SystemExit(f\"Unknown artifact schema {artifact_name!r}. Available: {sorted(available)}\")","typeGuard":"from schemas.artifacts import list_schemas\n\ndef schema_exists(name: str) -> bool:\n    return name in set(list_schemas())","tryCatchPattern":"try:\n    validate_artifact(name, data)\nexcept FileNotFoundError as e:\n    # unknown artifact name — the schema file was never found\n    raise SystemExit(f\"{e}; valid names: {list_schemas()}\") from e","preventionTips":["Resolve artifact names from list_schemas() instead of hand-typed strings.","Include *.schema.json files as package data in builds.","When adding a new artifact type, add its schema file in the same change."],"tags":["schemas","artifacts","validation","file-not-found"],"backgroundTag":null,"analyzedSha":"95e1c3d0ab93482159818560f6a8c8e866b9139f","analyzedAt":"2026-08-15T06:31:20.014Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}