{"record":{"id":"743d3077c8a7370f","repo":"BigPizzaV3/CodexPlusPlus","slug":"dream-skin-target-renderer-contains-unresolved-pla","errorCode":null,"errorMessage":"dream skin target renderer contains unresolved placeholders","messagePattern":"dream skin target renderer contains unresolved placeholders","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"crates/codex-plus-core/src/assets.rs","lineNumber":165,"sourceCode":"        )\n        .replace(\n            \"__DREAM_SKIN_THEME_JSON__\",\n            \"window.__CODEX_PLUS_DREAM_SKIN_THEME__\",\n        )\n        .replace(\n            \"__DREAM_SKIN_VERSION_JSON__\",\n            &serde_json::to_string(\"1.2.0\").unwrap(),\n        )\n        .replace(\n            \"__DREAM_SKIN_STYLE_REVISION_JSON__\",\n            &serde_json::to_string(&style_revision).unwrap(),\n        )\n        .replace(\n            \"__DREAM_SKIN_PAYLOAD_REVISION_JSON__\",\n            &serde_json::to_string(&payload_revision).unwrap(),\n        );\n    if payload.contains(\"__DREAM_\") || payload.contains(\"__GLASS_VISION_\") {\n        panic!(\"dream skin target renderer contains unresolved placeholders\");\n    }\n\n    let art_assignment = include_art.then(|| {\n        format!(\n            \"window.__CODEX_PLUS_DREAM_SKIN_ART__ = {};\\n\",\n            serde_json::to_string(&dream_skin_art_data_uri(settings))\n                .expect(\"dream skin target art should serialize\")\n        )\n    });\n    let skin_api_bootstrap = dream_skin_skin_api_bootstrap_script(&theme);\n    payload = format!(\n        \"(() => {{\\nwindow.__CODEX_PLUS_EXTERNAL_DREAM_SKIN_RUNTIME__ = true;\\nwindow.__CODEX_PLUS_CLEAR_DREAM_SKIN__?.();\\n{}window.__CODEX_PLUS_DREAM_SKIN_ART_SIGNATURE__ = {};\\nwindow.__CODEX_PLUS_DREAM_SKIN_THEME__ = {};\\nwindow.__CODEX_PLUS_DREAM_SKIN_RUNTIME_REVISION__ = {};\\nwindow.__CODEX_PLUS_DREAM_SKIN_TARGET_ENGINE__ = {};\\n{}const result = {};\\nconst state = window.__CODEX_DREAM_SKIN_STATE__ || window.__CODEX_GLASS_VISION_SKIN_STATE__;\\nif (state) {{\\n  state.version = `codex-plus:${{String(window.__CODEX_PLUS_DREAM_SKIN_PLATFORM__ || 'unknown')}}:${{window.__CODEX_PLUS_DREAM_SKIN_TARGET_ENGINE__}}:r${{window.__CODEX_PLUS_DREAM_SKIN_RUNTIME_REVISION__}}`;\\n  state.observer?.disconnect?.();\\n  if (state.timer) clearInterval(state.timer);\\n  state.observer = null;\\n  state.timer = null;\\n}}\\nwindow.__CODEX_PLUS_DREAM_SKIN_PAYLOAD_SIGNATURE__ = {};\\nreturn result;\\n}})()\",\n        art_assignment.unwrap_or_default(),\n        serde_json::to_string(&dream_skin_art_content_signature(settings)).unwrap(),\n        theme,\n        serde_json::to_string(DREAM_SKIN_RENDERER_REVISION).unwrap(),\n        serde_json::to_string(engine).unwrap(),\n        skin_api_bootstrap,","sourceCodeStart":147,"sourceCodeEnd":183,"githubUrl":"https://github.com/BigPizzaV3/CodexPlusPlus/blob/fb3ebd9a82383aedd8d098aa9ae3aef9426d13a4/crates/codex-plus-core/src/assets.rs#L147-L183","documentation":"The dream-skin renderer HTML is a template containing placeholders such as __DREAM_SKIN_VERSION_JSON__, __DREAM_SKIN_STYLE_REVISION_JSON__ and __DREAM_SKIN_PAYLOAD_REVISION_JSON__. After the replacement pass, the code asserts that no `__DREAM_` or `__GLASS_VISION_` tokens remain and panics otherwise. This panic means the embedded template contains a placeholder the Rust replacement chain does not know about - an internal template/code version mismatch, not a bad runtime input.","triggerScenarios":"Editing the bundled skin HTML to add a new __DREAM_*__ or __GLASS_VISION_*__ placeholder without adding the matching .replace() call in assets.rs; renaming a placeholder on only one side; a stale mixed build after a partial rebase where template and replacement code come from different commits.","commonSituations":"Fork work on the dream-skin feature; merging upstream skin changes; incremental build artifacts caching the old embedded template via include_str!/include_bytes!.","solutions":["cargo clean and rebuild to rule out a stale embedded template","Inspect the template (or dump the payload) and grep for __DREAM_ and __GLASS_VISION_ to identify the exact unresolved token","Add the missing .replace(\"__YOUR_TOKEN__\", &serde_json::to_string(value).unwrap()) entry next to the existing ones, or remove the token from the template","Add a unit test that renders the payload and asserts it contains no __DREAM_/__GLASS_VISION_ substrings"],"exampleFix":"// template uses: const rev = __DREAM_SKIN_ART_REVISION_JSON__;\n// before - no matching replace, so the final contains-check panics\n\n// after - add the replacement before the __DREAM_ / __GLASS_VISION_ check\npayload = payload.replace(\n    \"__DREAM_SKIN_ART_REVISION_JSON__\",\n    &serde_json::to_string(&art_revision).unwrap(),\n);","handlingStrategy":"validation","validationCode":"// CI guard: render the payload and assert no tokens remain\n#[test]\nfn dream_skin_payload_has_no_unresolved_placeholders() {\n    let payload = dream_skin_renderer_payload(&Default::default(), false);\n    assert!(!payload.contains(\"__DREAM_\"), \"unresolved __DREAM_ placeholder\");\n    assert!(!payload.contains(\"__GLASS_VISION_\"), \"unresolved __GLASS_VISION_ placeholder\");\n}","typeGuard":null,"tryCatchPattern":"// Only if a skin build must never take down the host process\nlet payload = std::panic::catch_unwind(|| build_dream_skin_payload(&settings))\n    .map_err(|p| anyhow::anyhow!(\"dream skin build panicked: {:?}\", p.downcast_ref::<&str>()))?;","preventionTips":["Grep the template for __ before every release and cross-check each token has a matching .replace() call","Keep placeholder names in one shared const list used by both template generation and replacement","Run the placeholder test in CI","cargo clean after merging skin template changes"],"tags":["panic","template","dream-skin","asset-embedding"],"backgroundTag":"unresolved-template-placeholder","analyzedSha":"fb3ebd9a82383aedd8d098aa9ae3aef9426d13a4","analyzedAt":"2026-08-17T11:35:12.031Z","contentChangedAt":"2026-08-17T11:35:12.031Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}