vectordotdev/vector · error
style checks failed
Error message
style checks failed
What it means
`style::check` scans eligible files for style violations such as trailing whitespace; if any file failed, it sets `failed = true`, prints per-file diagnostics first, and then bails with the summary message "style checks failed". It is the enforcement point of `vdev check style` used in CI.
Solutions
- Fix the files/lines listed in the output above the error (remove trailing spaces).
- Run an automated cleanup, e.g. `sed -i 's/[[:space:]]*$//' <files>` or your editor's 'trim trailing whitespace' action.
- Enable strip-trailing-whitespace-on-save in your editor to prevent recurrence.
- Re-run `vdev check style` to confirm it passes.
Example fix
// before: docs/example.md line 42 ends with two spaces See the docs. // after See the docs. // or bulk-fix $ sed -i 's/[[:space:]]*$//' docs/example.md
Defensive patterns
Strategy: validation
Validate before calling
# strip trailing whitespace from all tracked files before running the check git ls-files -z | xargs -0 sed -i 's/[[:space:]]*$//'
Try / catch
if let Err(e) = style_check() {
if e.to_string() == "style checks failed" {
eprintln!("see the listed files/lines above; trim trailing spaces and re-run");
}
} Prevention
- Enable trim-trailing-whitespace-on-save in your editor.
- Add a pre-commit hook that strips trailing spaces.
- Run `vdev check style` locally before pushing.
- Avoid pasting raw terminal/diff output into docs without cleanup.
When it happens
Trigger: Running `vdev check style` (or check_all which calls it) when one or more tracked files contain trailing spaces on any line; the offending files and line numbers are printed before the bail.
Common situations: Committing code edited in an editor without strip-trailing-whitespace, pasting terminal output or diff text into markdown files, or generating files in a script that appends spaces.
Understand the failure class
Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.
Related errors
- Cargo.lock was modified by `cargo
- duplicate upgrade-guide anchor '#
- invalid breaking fragment
- invalid breaking fragment
- invalid breaking fragment
AI-assisted analysis of vectordotdev/vector@bdb87aeaa4 (2026-09-16).
Data as JSON: /api/errors/369c687d143c3b07.
Report an issue: GitHub.
Appendix: source
Thrown at vdev/src/commands/style.rs:93
}
if issues.crlf {
println!("File \"{file}\" contains CRLF line breaks instead of LF line breaks");
failed = true;
}
if !issues.trailing_spaces.is_empty() {
let lines = issues
.trailing_spaces
.iter()
.map(usize::to_string)
.collect::<Vec<_>>()
.join(", ");
println!("File \"{file}\" contains trailing spaces on line(s): {lines}");
failed = true;
}
}
if failed {
bail!("style checks failed");
}
Ok(())
}
fn eligible_files(files: Vec<String>) -> Vec<String> {
files
.into_iter()
.filter(|file| {
!IGNORED_PATHS.iter().any(|pattern| pattern.matches(file))
&& fs::symlink_metadata(file).is_ok_and(|metadata| metadata.file_type().is_file())
})
.collect()
}
fn inspect(contents: &[u8]) -> Issues {
let mut issues = Issues {
missing_newline: !contents.is_empty() && !contents.ends_with(b"\n"),View on GitHub (pinned to bdb87aeaa4)