slint-ui/slint · error
unexpected header. expected
Error message
unexpected header.
expected: {}
found: {} What it means
check_file_tags throws this when a file HAS a license tag but its content does not match the expected Slint header (EXPECTED_HEADER). The error shows the expected and found header text for comparison.
Solutions
- Run `cargo xtask check --fix` to replace the wrong header with EXPECTED_HEADER
- Manually replace the file's header with the exact expected text shown in the error message
- Compare the 'found:' output against the expected text to see what differs (usually SPDX id or copyright line)
Example fix
// before // SPDX-License-Identifier: MIT // after // Copyright © SixtyFPS GmbH <info@slint.dev> // SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-commercial
Defensive patterns
Strategy: validation
Validate before calling
let src = std::fs::read_to_string(path)?;
let expected = "// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-commercial";
if !src.contains(expected) {
panic!("{path}: wrong SPDX header, expected {expected}");
} Type guard
fn header_matches(src: &str, expected: &str) -> bool {
src.lines().take(5).any(|l| l.trim() == expected)
} Prevention
- Diff headers against the expected text after any license policy change
- Don't copy headers from third-party projects
- Run a bulk sed/script to normalize headers after policy updates, then --fix
- Keep reformat tools (rustfmt etc.) from touching the header lines
When it happens
Trigger: A file whose header differs in copyright line, SPDX identifier, or formatting (e.g. an older header variant, wrong year range, or `// SPDX-License-Identifier: MIT` instead of the required expression), checked without --fix.
Common situations: License policy change leaving stale headers; copying a header from another project; reformatting tools mangling the header; an import from a fork.
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
- Missing tag
- License ` ` of crate is not in the accepted list
- Missing LICENSES directory for published crate
- No license file found in root LICENSES/ for SPDX id
- Encountered one or multiple errors. See above for details.
AI-assisted analysis of slint-ui/slint@3a7e700487 (2026-09-16).
Data as JSON: /api/errors/4d0b3eb4a4232dd7.
Report an issue: GitHub.
Appendix: source
Thrown at xtask/src/license_headers_check.rs:991
let source = SourceFileWithTags::new(source, style);
if !source.has_tag() {
if self.fix_it {
eprintln!("Fixing up {path:?} as instructed. It's missing a license header.");
let source = source.replace_tag(&EXPECTED_HEADER, license);
std::fs::write(path, source).context("Error writing source")
} else {
Err(anyhow!("Missing tag"))
}
} else if source.tag_matches(&EXPECTED_HEADER, license) {
Ok(())
} else if self.fix_it {
eprintln!("Fixing up {path:?} as instructed. It has a wrong license header.");
let source = source.replace_tag(&EXPECTED_HEADER, license);
std::fs::write(path, source).context("Error writing new source")
} else {
Err(anyhow!(
"unexpected header.\nexpected: {}\nfound: {}",
EXPECTED_HEADER.to_string(style, license),
source.found_tag()
))
}
}
fn check_cargo_toml(&self, path: &Path, license: &str) -> Result<()> {
let mut doc = CargoToml::new(path)?;
if doc.is_workspace() {
let mut wv = self.workspace_version.borrow_mut();
if (*wv).is_empty() {
*wv = doc.workspace_version()?.to_string();
}
let expected_version = wv.clone();
// Check the workspace.dependencies:View on GitHub (pinned to 3a7e700487)