sharkdp/bat · error

acknowledgements is not the empty string

Error message

acknowledgements is not the empty string

What it means

Error "acknowledgements is not the empty string" thrown in sharkdp/bat.

Source

Thrown at src/assets/build_assets/acknowledgements.rs:137

}

fn license_contains_marker(license_text: &str, markers: &[&str]) -> bool {
    let normalized_license_text = normalize_license_text(license_text);
    markers.iter().any(|m| normalized_license_text.contains(m))
}

fn append_to_acknowledgements(
    acknowledgements: &mut String,
    relative_path: &str,
    license_text: &str,
) {
    write!(acknowledgements, "## {relative_path}\n\n{license_text}").ok();

    // Make sure the last char is a newline to not mess up formatting later
    if acknowledgements
        .chars()
        .last()
        .expect("acknowledgements is not the empty string")
        != '\n'
    {
        acknowledgements.push('\n');
    }

    // Add two more newlines to make it easy to distinguish where this text ends
    // and the next starts
    acknowledgements.push_str("\n\n");
}

/// Replaces newlines with a space character, and replaces multiple spaces with one space.
/// This makes the text easier to analyze.
fn normalize_license_text(license_text: &str) -> String {
    use regex::Regex;

    let whitespace_and_newlines = Regex::new(r"\s").unwrap();
    let as_single_line = whitespace_and_newlines.replace_all(license_text, " ");

View on GitHub (pinned to b671e53c2c)

When it happens

Trigger: Thrown at src/assets/build_assets/acknowledgements.rs:137 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/bc0fa2c696d254b3. Report an issue: GitHub.