{"record":{"id":"f4e2ed222493cfb2","repo":"rtk-ai/rtk","slug":"invalid-ctest-start-regex","errorCode":null,"errorMessage":"invalid ctest start regex","messagePattern":"invalid ctest start regex","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cmds/system/ctest_cmd.rs","lineNumber":37,"sourceCode":"// Failure entries carry a header plus up to `MAX_FAILURE_LINES` detail lines each,\n// so this list deviates below `CAP_LIST`; the single-line skipped and raw-trailer\n// lists keep the full cap.\nconst MAX_FAILED_BLOCK_ENTRIES: usize = truncate::reduced(CAP_LIST, 5);\n\nstatic TEST_RE: LazyLock<Regex> = LazyLock::new(|| {\n    Regex::new(\n        r\"(?s)^\\s*(?:\\d+/(\\d+)\\s+)?Test\\s+#(\\d+):\\s+(.+?)\\s+\\.{2,}\\s*(?:\\*{3})?\\s*(.+?)\\s+([\\d.]+)\\s+sec\\s*$\",\n    )\n    .expect(\"invalid ctest result regex\")\n});\nstatic RESULT_PREFIX_RE: LazyLock<Regex> = LazyLock::new(|| {\n    Regex::new(r\"^\\s*(?:\\d+/\\d+\\s+)?Test\\s+#\\d+:\").expect(\"invalid ctest result prefix regex\")\n});\nstatic RESULT_TERMINATOR_RE: LazyLock<Regex> = LazyLock::new(|| {\n    Regex::new(r\"[\\d.]+\\s+sec\\s*$\").expect(\"invalid ctest result terminator regex\")\n});\nstatic START_RE: LazyLock<Regex> = LazyLock::new(|| {\n    Regex::new(r\"^\\s*Start\\s+(\\d+):\\s*(.*?)\\s*$\").expect(\"invalid ctest start regex\")\n});\nstatic SUMMARY_RE: LazyLock<Regex> = LazyLock::new(|| {\n    Regex::new(r\"^\\s*\\d+%\\s+tests passed,\\s+(\\d+)\\s+tests failed out of\\s+(\\d+)\")\n        .expect(\"invalid ctest summary regex\")\n});\nstatic TIME_RE: LazyLock<Regex> = LazyLock::new(|| {\n    Regex::new(r\"^\\s*Total Test time \\(real\\)\\s+=\\s+([\\d.]+)\\s+sec\")\n        .expect(\"invalid ctest time regex\")\n});\n\n#[derive(Debug, Clone)]\nstruct TestCase {\n    number: u32,\n    name: String,\n    status: String,\n    reason: Option<String>,\n    duration: f64,\n    line_index: usize,","sourceCodeStart":19,"sourceCodeEnd":55,"githubUrl":"https://github.com/rtk-ai/rtk/blob/0924356b4caba4989607227b7c8824d3d8098719/src/cmds/system/ctest_cmd.rs#L19-L55","documentation":"Panic message from the .expect() on START_RE in src/cmds/system/ctest_cmd.rs, which matches ctest 'Start N:' lines to capture the test executable being launched. rtk compiles this lazily at first filter use; invalid regex syntax aborts with this message instead of an error value. The shipped pattern is valid, so this is an internal invariant violation only reachable from broken source builds.","triggerScenarios":"First access of START_RE during an `rtk ctest` run after a source edit introduced invalid regex syntax in the pattern (bad group, invalid escape sequence).","commonSituations":"Developer typo while tuning the Start-line regex; broken merge of the statics block; older regex crate rejecting newer syntax.","solutions":["Fix the regex syntax in the START_RE literal in src/cmds/system/ctest_cmd.rs","Run `cargo test ctest` (or any test touching the static) to validate compilation","Bypass the filter with `rtk proxy ctest ...` if you need output immediately","Rebuild with `cargo build` after the fix"],"exampleFix":"// before\nRegex::new(r\"^\\s*Start\\s+(\\d+):\\s*(.*?)\\s*$\").expect(\"invalid ctest start regex\")\n// after (balance groups if one was removed)\nRegex::new(r\"^\\s*Start\\s+(\\d+):\\s*(.*?)\\s*$\").expect(\"invalid ctest start regex\")","handlingStrategy":"validation","validationCode":"assert!(regex::Regex::new(r\"^\\s*Start\\s+(\\d+):\\s*(.*?)\\s*$\").is_ok(), \"START_RE must compile\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Add a compile-check test for START_RE","Resolve merge conflicts in the regex statics block carefully","Test regex changes with real ctest fixtures","Workaround via `rtk proxy ctest ...`"],"tags":["rust","regex","panic","ctest"],"backgroundTag":"invalid-regex-pattern","analyzedSha":"0924356b4caba4989607227b7c8824d3d8098719","analyzedAt":"2026-09-19T19:25:29.612Z","contentChangedAt":"2026-09-19T19:25:29.612Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}