sharkdp/bat · error

A builtin fixed glob matcher failed to compile

Error message

A builtin fixed glob matcher failed to compile

What it means

Error "A builtin fixed glob matcher failed to compile" thrown in sharkdp/bat.

Source

Thrown at src/syntax_mapping/builtin.rs:57

// The benefit for this is that operations like listing all builtin mappings
// would be effectively memoised. The caller would not have to compile another
// `GlobMatcher` for rules that they have previously visited.
//
// Unfortunately, this means we are going to have to store a distinct closure
// for each rule anyway, which makes a `BuiltinMatcher` enum a pointless layer
// of indirection.
//
// In the current implementation, the closure within each generated rule simply
// calls either `build_matcher_fixed` or `build_matcher_dynamic`, depending on
// whether the defined matcher contains dynamic segments or not.

/// Compile a fixed glob string into a glob matcher.
///
/// A failure to compile is a fatal error.
///
/// Used internally by `Lazy<Option<GlobMatcher>>`'s lazy evaluation closure.
fn build_matcher_fixed(from: &str, case: Case) -> GlobMatcher {
    make_glob_matcher(from, case).expect("A builtin fixed glob matcher failed to compile")
}

/// Join a list of matcher segments to create a glob string, replacing all
/// environment variables, then compile to a glob matcher.
///
/// Returns `None` if any replacement fails, or if the joined glob string fails
/// to compile.
///
/// Used internally by `Lazy<Option<GlobMatcher>>`'s lazy evaluation closure.
fn build_matcher_dynamic(segs: &[MatcherSegment], case: Case) -> Option<GlobMatcher> {
    // join segments
    let mut buf = String::new();
    for seg in segs {
        match seg {
            MatcherSegment::Text(s) => buf.push_str(s),
            MatcherSegment::Env(var) => {
                let replaced = env::var(var).ok()?;
                buf.push_str(&replaced);

View on GitHub (pinned to b671e53c2c)

When it happens

Trigger: Thrown at src/syntax_mapping/builtin.rs:57 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of sharkdp/bat@b671e53c2c (2026-08-16). Data as JSON: /api/errors/a67b61a56cddc924. Report an issue: GitHub.