{"record":{"id":"2db9d3987c970027","repo":"Hmbown/CodeWhale","slug":"expected-an-opening-tag-got-other","errorCode":null,"errorMessage":"expected an opening tag, got {other:?}","messagePattern":"expected an opening tag, got (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/image_attach/tests.rs","lineNumber":281,"sourceCode":"}\n\n#[test]\nfn expands_a_placeholder_into_an_image_block() {\n    let dir = tempfile::tempdir().expect(\"tempdir\");\n    let path = write_png(dir.path(), \"shot.png\");\n    let text = format!(\"look at this\\n[Attached image: {}]\", path.display());\n\n    let expanded = expand_attachment_blocks(&text);\n\n    assert!(expanded.notices.is_empty(), \"{expanded:?}\");\n    // Bracketed: open tag naming the path, the image, close tag.\n    assert_eq!(expanded.blocks.len(), 3, \"{expanded:?}\");\n    match &expanded.blocks[0] {\n        ContentBlock::Text { text, .. } => {\n            assert!(text.starts_with(\"<image path=\\\"\"), \"{text}\");\n            assert!(text.contains(\"shot.png\"), \"{text}\");\n        }\n        other => panic!(\"expected an opening tag, got {other:?}\"),\n    }\n    match &expanded.blocks[1] {\n        ContentBlock::ImageUrl { image_url } => {\n            assert!(image_url.url.starts_with(\"data:image/png;base64,\"));\n        }\n        other => panic!(\"expected an image block, got {other:?}\"),\n    }\n    assert_eq!(\n        expanded.blocks[2],\n        ContentBlock::Text {\n            text: \"</image>\".to_string(),\n            cache_control: None\n        }\n    );\n}\n\n#[test]\nfn expands_multiple_placeholders_in_order() {","sourceCodeStart":263,"sourceCodeEnd":299,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/433685b2024e7bc4c99e1e2e326bcad39b4d9d65/crates/tui/src/image_attach/tests.rs#L263-L299","documentation":"Test-only panic in expands_a_placeholder_into_an_image_block: the first expanded block was not the expected ContentBlock::Text open tag (e.g. it came back as an ImageUrl or other variant), so the placeholder expansion produced an unexpected block ordering.","triggerScenarios":"Thrown at crates/tui/src/image_attach/tests.rs:281 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix expand_attachment_blocks so the first block is always the textual '<image path=...>' open tag when a placeholder is expanded","Check the expanded.notices field for parse failures that shift blocks","Update the match arms if the block contract intentionally changed"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"433685b2024e7bc4c99e1e2e326bcad39b4d9d65","analyzedAt":"2026-09-15T12:24:24.634Z","contentChangedAt":"2026-09-15T12:24:24.634Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}