{"id":"e94831bd48b65103","repo":"BurntSushi/ripgrep","slug":"regex-could-not-be-compiled-with-either-the-defaul","errorCode":null,"errorMessage":"regex could not be compiled with either the default regex engine or with PCRE2.\n\ndefault regex engine error:\n{divider}\n{rust_err}\n{divider}\n\nPCRE2 regex engine error:\n{pcre_err}","messagePattern":"regex could not be compiled with either the default regex engine or with PCRE2\\.\n\ndefault regex engine error:\n(.+?)\n(.+?)\n(.+?)\n\nPCRE2 regex engine error:\n(.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/core/flags/hiargs.rs","lineNumber":402,"sourceCode":"                    anyhow::bail!(suggest_other_engine(err.to_string()));\n                }\n            },\n            EngineChoice::PCRE2 => Ok(self.matcher_pcre2()?),\n            EngineChoice::Auto => {\n                let rust_err = match self.matcher_rust() {\n                    Ok(m) => return Ok(m),\n                    Err(err) => err,\n                };\n                log::debug!(\n                    \"error building Rust regex in hybrid mode:\\n{rust_err}\",\n                );\n\n                let pcre_err = match self.matcher_pcre2() {\n                    Ok(m) => return Ok(m),\n                    Err(err) => err,\n                };\n                let divider = \"~\".repeat(79);\n                anyhow::bail!(\n                    \"regex could not be compiled with either the default \\\n                     regex engine or with PCRE2.\\n\\n\\\n                     default regex engine error:\\n\\\n                     {divider}\\n\\\n                     {rust_err}\\n\\\n                     {divider}\\n\\n\\\n                     PCRE2 regex engine error:\\n{pcre_err}\",\n                );\n            }\n        }\n    }\n\n    /// Build a matcher using PCRE2.\n    ///\n    /// If there was a problem building the matcher (such as a regex syntax\n    /// error), then an error is returned.\n    ///\n    /// If the `pcre2` feature is not enabled then this always returns an","sourceCodeStart":384,"sourceCodeEnd":420,"githubUrl":"https://github.com/BurntSushi/ripgrep/blob/3fce3b5bb0236da2df6d99672afb8a719642eca7/crates/core/flags/hiargs.rs#L384-L420","documentation":"Error \"regex could not be compiled with either the default regex engine or with PCRE2.\n\ndefault regex engine error:\n{divider}\n{rust_err}\n{divider}\n\nPCRE2 regex engine error:\n{pcre_err}\" thrown in BurntSushi/ripgrep.","triggerScenarios":"Thrown at crates/core/flags/hiargs.rs:402 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix the regex syntax errors reported by both engines in the message","Test the pattern with a simpler subset to isolate the invalid construct"],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"analyzedSha":"3fce3b5bb0236da2df6d99672afb8a719642eca7","analyzedAt":"2026-08-06T01:39:05.073Z","schemaVersion":2}