{"record":{"id":"36e61c126eaeb671","repo":"calesthio/OpenMontage","slug":"stage-stage-r-with-status-status-r-must-includ","errorCode":null,"errorMessage":"Stage {stage!r} with status {status!r} must include canonical artifact {required_artifact!r}","messagePattern":"Stage (.+?) with status (.+?) must include canonical artifact (.+?)","errorType":"validation","errorClass":"CheckpointValidationError","httpStatus":null,"severity":"error","filePath":"lib/checkpoint.py","lineNumber":140,"sourceCode":"\n\ndef _validate_artifacts_for_stage(\n    stage: str,\n    status: str,\n    artifacts: dict[str, Any],\n) -> None:\n    # Valid stages come from the pipeline manifest (get_pipeline_stages), which\n    # can declare stages beyond the 9 canonical ones (e.g. character-animation's\n    # `character_design`/`rig_plan`, screen-demo's `real_capture`). Those have no\n    # canonical artifact, so look it up defensively — a missing entry means the\n    # stage simply has no required artifact, not a crash.\n    required_artifact = CANONICAL_STAGE_ARTIFACTS.get(stage)\n    if (\n        required_artifact is not None\n        and status in {\"completed\", \"awaiting_human\"}\n        and required_artifact not in artifacts\n    ):\n        raise CheckpointValidationError(\n            f\"Stage {stage!r} with status {status!r} must include \"\n            f\"canonical artifact {required_artifact!r}\"\n        )\n\n    for artifact_name, artifact_data in artifacts.items():\n        if artifact_name not in ARTIFACT_NAMES:\n            continue\n        if not isinstance(artifact_data, dict):\n            raise CheckpointValidationError(\n                f\"Artifact {artifact_name!r} must be a JSON object matching its schema\"\n            )\n        try:\n            validate_artifact(artifact_name, artifact_data)\n        except Exception as exc:\n            raise CheckpointValidationError(\n                f\"Artifact {artifact_name!r} failed schema validation: {exc}\"\n            ) from exc\n","sourceCodeStart":122,"sourceCodeEnd":158,"githubUrl":"https://github.com/calesthio/OpenMontage/blob/95e1c3d0ab93482159818560f6a8c8e866b9139f/lib/checkpoint.py#L122-L158","documentation":"The data URI was syntactically valid, but its declared MIME type is not in the supported set for that label (the set of values from the tool's suffix→MIME map for images or audio). The tool refuses to forward media in a format Ark does not accept.","triggerScenarios":"data:image/avif;base64,... or data:audio/ogg;base64,... when those MIME types are not in the map; declaring image/* generically; a GIF/HEIC data URI when only jpeg/png/webp are accepted.","commonSituations":"Browser-originated assets (webp/avif) pasted as data URIs; encoder defaults producing formats outside the allowlist; mimicking another provider's accepted data-URI formats.","solutions":["Re-encode to a supported MIME (jpeg/png/webp for images; the tool's listed audio formats for audio).","Pass a local file so the tool derives the MIME from a controlled extension.","Check the error-adjacent list: the unsupported-formats error prints the accepted suffixes for local files; keep data-URI MIME aligned with that set."],"exampleFix":"# before\nref = \"data:image/avif;base64,AAAA...\"\n# after\nimport base64\nfrom PIL import Image\nimg = Image.open(\"photo.avif\").convert(\"RGB\")\nimg.save(\"photo.jpg\", quality=85)\nref = \"data:image/jpeg;base64,\" + base64.b64encode(open(\"photo.jpg\",\"rb\").read()).decode()","handlingStrategy":"type-guard","validationCode":"SUPPORTED_MIMES = {\"image/jpeg\", \"image/png\", \"image/webp\"}  # align with the tool's map values\nassert ref.split(\";\", 1)[0].removeprefix(\"data:\").lower() in SUPPORTED_MIMES","typeGuard":"def data_uri_mime_ok(v: str, allowed: set[str]) -> bool:\n    return v[5:].split(\";\", 1)[0].lower() in allowed if v.startswith(\"data:\") else False","tryCatchPattern":"try:\n    tool.run(inputs)\nexcept ValueError as e:\n    if \"Data URI MIME type\" in str(e):\n        transcode_to_supported_mime(ref)  # re-encode, rebuild URI, retry\n    else:\n        raise","preventionTips":["Restrict client-side exports to jpeg/png/webp before creating data URIs.","Pass local files when format control matters; the tool then derives the MIME."],"tags":["python","validation","data-uri","mime","unsupported-format","seedance"],"backgroundTag":null,"analyzedSha":"95e1c3d0ab93482159818560f6a8c8e866b9139f","analyzedAt":"2026-08-15T06:31:20.014Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}