tracel-ai/burn · error
Invalid regex pattern
Error message
Invalid regex pattern
What it means
Generic sentinel panic from with_regex: the regex crate rejected the user-supplied pattern string, so this fires for any invalid regular expression syntax (unbalanced parens, bad repetition, invalid escapes, etc.) rather than one specific fault. The input at fault is the pattern argument passed to with_regex. The function's doc already notes it panics on invalid regex.
Source
Thrown at crates/burn-store/src/filter.rs:72
Self {
match_all: true,
..Default::default()
}
}
/// Create a filter that matches nothing
pub fn none() -> Self {
Self::default()
}
/// Add a regex pattern for matching paths
///
/// # Panics
///
/// Panics if `pattern` is not a valid regular expression.
#[cfg(feature = "std")]
pub fn with_regex<S: AsRef<str>>(mut self, pattern: S) -> Self {
let regex = Regex::new(pattern.as_ref()).expect("Invalid regex pattern");
self.regex_patterns.push(regex);
self
}
/// Add multiple regex patterns
///
/// # Panics
///
/// Panics if any pattern is not a valid regular expression.
#[cfg(feature = "std")]
pub fn with_regexes<I, S>(mut self, patterns: I) -> Self
where
I: IntoIterator<Item = S>,
S: AsRef<str>,
{
for pattern in patterns {
let regex = Regex::new(pattern.as_ref()).expect("Invalid regex pattern");
self.regex_patterns.push(regex);View on GitHub (pinned to d16f7ba2ed)
Solutions
- Validate the pattern with `Regex::new` before calling with_regex
- Fix unbalanced groups/brackets or bad escapes in the pattern
- Use a fallible API on KeyRemapper/Filter if runtime validation is preferred
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/burn-store/src/filter.rs:72 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of tracel-ai/burn@d16f7ba2ed (2026-09-05).
Data as JSON: /api/errors/f1143f7ba6130dd4.
Report an issue: GitHub.