{"record":{"id":"1249eae99338ecd2","repo":"Hmbown/CodeWhale","slug":"tag-regex","errorCode":null,"errorMessage":"tag regex","messagePattern":"tag regex","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/tools/web_run.rs","lineNumber":1352,"sourceCode":"// === HTML Parsing ===\n\nstatic ANCHOR_RE: OnceLock<Regex> = OnceLock::new();\nstatic TAG_RE: OnceLock<Regex> = OnceLock::new();\nstatic BLOCK_RE: OnceLock<Regex> = OnceLock::new();\nstatic SCRIPT_RE: OnceLock<Regex> = OnceLock::new();\nstatic STYLE_RE: OnceLock<Regex> = OnceLock::new();\nstatic TITLE_RE: OnceLock<Regex> = OnceLock::new();\nstatic MARKDOWN_LINK_RE: OnceLock<Regex> = OnceLock::new();\n\nfn get_anchor_re() -> &'static Regex {\n    ANCHOR_RE.get_or_init(|| {\n        Regex::new(r#\"(?is)<a\\s+[^>]*href\\s*=\\s*['\\\"]([^'\\\"]+)['\\\"][^>]*>(.*?)</a>\"#)\n            .expect(\"anchor regex\")\n    })\n}\n\nfn get_tag_re() -> &'static Regex {\n    TAG_RE.get_or_init(|| Regex::new(r\"<[^>]+>\").expect(\"tag regex\"))\n}\n\nfn get_block_re() -> &'static Regex {\n    BLOCK_RE.get_or_init(|| {\n        Regex::new(r\"(?is)</?(p|div|li|ul|ol|br|h[1-6]|tr|td|th|table|section|article)[^>]*>\")\n            .expect(\"block regex\")\n    })\n}\n\nfn get_script_re() -> &'static Regex {\n    SCRIPT_RE.get_or_init(|| Regex::new(r\"(?is)<script[^>]*>.*?</script>\").unwrap())\n}\n\nfn get_style_re() -> &'static Regex {\n    STYLE_RE.get_or_init(|| Regex::new(r\"(?is)<style[^>]*>.*?</style>\").unwrap())\n}\n\nfn get_title_re() -> &'static Regex {","sourceCodeStart":1334,"sourceCodeEnd":1370,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/0c42157ee52f9d55af2b506d71b46249910f77d3/crates/tui/src/tools/web_run.rs#L1334-L1370","documentation":"Compilation assertion for TAG_RE (r\"<[^>]+>\"), which strips HTML tags during page-to-text conversion. The expect fires only when this hardcoded literal fails to compile — a developer mistake at first use of get_tag_re, since OnceLock defers Regex::new until the first parse call.","triggerScenarios":"Thrown at crates/tui/src/tools/web_run.rs:1352 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Cover get_tag_re in a unit test so an invalid literal fails in CI","Keep the pattern a static literal; no runtime construction path exists","Use regex crate syntax checks (regex_tests or a compile test) when editing the pattern"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"0c42157ee52f9d55af2b506d71b46249910f77d3","analyzedAt":"2026-08-20T21:50:45.477Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}