stamparm/maltrail · error

unable to compile the combined wildcard-trail regex

Error message

unable to compile the combined wildcard-trail regex ({e}); wildcard trail matching is disabled

What it means

The combined regular expression built from all wildcard-trail patterns failed to compile. As a safety measure the sensor disables wildcard trail matching entirely rather than crashing, so trails whose matching depends on this regex engine will not fire until the problem is fixed.

Solutions

  1. Read the wrapped {e} — it names the regex compile problem (syntax or size/complexity limit) to locate the offending trail pattern.
  2. Bisect the wildcard trail set (remove recent trail additions) until the combined regex compiles, then fix or remove the offending trail.
  3. Reduce wildcard trail complexity (anchor trails, avoid nested/excessive wildcards) to stay under the engine's limits.
  4. Note the operational impact: wildcard trail matching stays disabled until a successful rebuild, so monitor for this log line after every trail update.
Defensive patterns

Strategy: validation

Validate before calling

# validate trail patterns before deploying them
# compile the combined wildcard-trail regex offline and fail the deploy on error
python3 -c "import re,sys; re.compile(open(sys.argv[1]).read())" wildcard_trails.txt || echo "combined regex invalid"

Prevention

When it happens

Trigger: build() calls pyre::build_fancy(&self.source) with the aggregated wildcard-trail pattern and gets Err(e) — usually a pattern that exceeds the backtracking engine's limits or a construct it cannot handle after combination.

Common situations: A newly deployed trail set contains a wildcard pattern that produces an over-large or invalid combined regex; regex size/complexity limits exceeded by growing trail counts; an upstream trail feed shipping a pathological pattern.

Related errors


AI-assisted analysis of stamparm/maltrail@77cfb06d76 (2026-09-13). Data as JSON: /api/errors/6bfc14e2682571d9. Report an issue: GitHub.

Appendix: source

Thrown at sensor/src/trails/regexset.rs:267

        self.source.push_str(&format!("(?P<g{}>{})", self.patterns.len(), compiled));
        self.patterns.push(trail.to_string());
    }

    pub fn build(self) -> TrailRegex {
        let mut fancy = false;
        let regex = if self.source.is_empty() {
            None
        } else {
            let fast = if self.needs_fancy { None } else { pyre::build(&self.source).ok() };
            match fast {
                Some(re) => Some(Engine::Fast(re)),
                None => match pyre::build_fancy(&self.source) {
                    Ok(re) => {
                        fancy = true;
                        Some(Engine::Backtracking(re))
                    }
                    Err(e) => {
                        crate::output::log_error(
                            &format!(
                                "unable to compile the combined wildcard-trail regex ({e}); \
                                 wildcard trail matching is disabled"
                            ),
                            true,
                        );
                        None
                    }
                },
            }
        };
        TrailRegex {
            regex,
            patterns: self.patterns,
            source: self.source,
            skipped: self.skipped,
            repaired: self.repaired,
            fancy,

View on GitHub (pinned to 77cfb06d76)