{"record":{"id":"8ebd7f723d1fa820","repo":"calesthio/OpenMontage","slug":"unknown-or-invalid-style-playbook-style-playbook","errorCode":null,"errorMessage":"Unknown or invalid style_playbook {style_playbook!r}. Available playbooks: {available}. Underlying error: {exc}","messagePattern":"Unknown or invalid style_playbook (.+?)\\. Available playbooks: (.+?)\\. Underlying error: (.+?)","errorType":"validation","errorClass":"CheckpointValidationError","httpStatus":null,"severity":"error","filePath":"lib/checkpoint.py","lineNumber":112,"sourceCode":"class CheckpointValidationError(ValueError):\n    \"\"\"Raised when a checkpoint or its canonical artifacts are invalid.\"\"\"\n\n\ndef _validate_style_playbook(style_playbook: str | None) -> None:\n    \"\"\"Fail closed when a checkpoint names a visual identity that cannot load.\"\"\"\n\n    if style_playbook is None:\n        return\n    try:\n        from styles.playbook_loader import list_playbooks, load_playbook\n\n        load_playbook(style_playbook)\n    except Exception as exc:\n        try:\n            available = list_playbooks()\n        except Exception:\n            available = []\n        raise CheckpointValidationError(\n            f\"Unknown or invalid style_playbook {style_playbook!r}. \"\n            f\"Available playbooks: {available}. Underlying error: {exc}\"\n        ) from exc\n\n\n@lru_cache(maxsize=1)\ndef _load_checkpoint_schema() -> dict[str, Any]:\n    with open(CHECKPOINT_SCHEMA_PATH, encoding=\"utf-8\") as f:\n        return json.load(f)\n\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","sourceCodeStart":94,"sourceCodeEnd":130,"githubUrl":"https://github.com/calesthio/OpenMontage/blob/95e1c3d0ab93482159818560f6a8c8e866b9139f/lib/checkpoint.py#L94-L130","documentation":"The reference value started with \"data:\" but did not match the strict regex data:<mime>;base64,<base64chars>. Anything else — missing \";base64\", URL-encoded payloads, whitespace inside the payload, plain-text data URIs, or commas/quotes in the base64 portion — is rejected up front.","triggerScenarios":"Passing \"data:image/png,url-encoded-bytes\" (no base64 marker); a data URI containing newlines from JSON string wrapping; a truncated URI; MIME with unusual casing is fine (IGNORECASE) but parameters like ;charset=utf-8 before base64 break the match.","commonSituations":"Hand-building data URIs; LLMs emitting slightly malformed data URIs; HTML-sourced data URIs that include extra parameters; copy-paste truncation at a fixed column limit.","solutions":["Emit exactly data:<mime>;base64,<payload> with no extra parameters or whitespace.","Strip whitespace/newlines from the payload before sending.","Prefer passing a local file path or https URL and let the tool construct the data URI."],"exampleFix":"# before\nref = \"data:image/png;charset=utf-8;base64,iVBOR...\"\n# after\nref = \"data:image/png;base64,iVBOR...\"","handlingStrategy":"type-guard","validationCode":"import re\nDATA_URI_RE = re.compile(r\"data:[a-z]+/[a-z0-9.+-]+;base64,[A-Za-z0-9+/=]+\", re.IGNORECASE)\nassert DATA_URI_RE.fullmatch(ref), \"malformed data URI\"","typeGuard":"def is_strict_data_uri(v: str) -> bool:\n    import re\n    return bool(re.fullmatch(r\"data:[a-z]+/[a-z0-9.+-]+;base64,[A-Za-z0-9+/=]+\", v, re.IGNORECASE))","tryCatchPattern":"try:\n    tool.run(inputs)\nexcept ValueError as e:\n    if \"strict base64 encoding\" in str(e):\n        rebuild_data_uri(ref)  # re-encode from source file with no extra params, retry\n    else:\n        raise","preventionTips":["Always build data URIs programmatically: f\"data:{mime};base64,{b64}\" — never hand-edit.","Strip whitespace and additional parameters (;charset=...) before sending."],"tags":["python","validation","data-uri","base64","reference","seedance"],"backgroundTag":null,"analyzedSha":"95e1c3d0ab93482159818560f6a8c8e866b9139f","analyzedAt":"2026-08-15T06:31:20.014Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}