{"record":{"id":"7ee4d8075c93605d","repo":"Hmbown/CodeWhale","slug":"expected-an-image-block-got-other","errorCode":null,"errorMessage":"expected an image block, got {other:?}","messagePattern":"expected an image block, got (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/image_attach/tests.rs","lineNumber":287,"sourceCode":"    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() {\n    let dir = tempfile::tempdir().expect(\"tempdir\");\n    let first = write_png(dir.path(), \"one.png\");\n    let second = write_png(dir.path(), \"two.png\");\n    std::fs::write(&second, [0xff, 0xd8, 0xff, 0xe0, 0x01]).expect(\"write jpeg\");\n    let text = format!(\n        \"[Attached image: {}]\\nand\\n[Attached image: {}]\",","sourceCodeStart":269,"sourceCodeEnd":305,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/433685b2024e7bc4c99e1e2e326bcad39b4d9d65/crates/tui/src/image_attach/tests.rs#L269-L305","documentation":"Test-only panic: after matching ContentBlock::Text in expands_a_placeholder_into_an_image_block, the first block did not match any expected arm; the expansion emitted something other than the opening text tag naming the attached image path.","triggerScenarios":"Thrown at crates/tui/src/image_attach/tests.rs:287 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure expand_attachment_blocks emits the open text tag as blocks[0] before the image block","Inspect expanded.notices for attachment parse errors that change block shape","Adjust the test's expected ordering only if the contract legitimately 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"}