{"record":{"id":"617f4f5e70000fbb","repo":"Hmbown/CodeWhale","slug":"block-regex","errorCode":null,"errorMessage":"block regex","messagePattern":"block regex","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/tools/web_run.rs","lineNumber":1358,"sourceCode":"static 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 {\n    TITLE_RE.get_or_init(|| Regex::new(r\"(?is)<title[^>]*>(.*?)</title>\").unwrap())\n}\n\nfn parse_html(html: &str, base_url: &str) -> (Vec<String>, Vec<WebLink>, Option<String>) {\n    let title = extract_title(html);\n    let without_scripts = get_script_re().replace_all(html, \"\").to_string();","sourceCodeStart":1340,"sourceCodeEnd":1376,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/0c42157ee52f9d55af2b506d71b46249910f77d3/crates/tui/src/tools/web_run.rs#L1340-L1376","documentation":"Compilation assertion for BLOCK_RE, the pattern matching block-level HTML tags (p, div, li, ul, ol, br, h1-6, table elements) used to insert line breaks when flattening pages. The expect fires only if the hardcoded literal is syntactically invalid — a programmer error, surfaced at the first html_to_text call.","triggerScenarios":"Thrown at crates/tui/src/tools/web_run.rs:1358 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Add a unit test touching get_block_re so bad literals break the build, not runtime","Edit the pattern only with cargo test -p codewhale-tui run afterwards","Keep the alternation group balanced when adding tag names"],"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"}