slint-ui/slint · error
Missing tag
Error message
Missing tag
What it means
check_file_tags throws "Missing tag" when a source file has no license header tag at all and the check runs without --fix. The check expects every source file to begin with the standard Slint SPDX/license header comment.
Solutions
- Run `cargo xtask check --fix` which prepends the expected license header automatically
- Copy the standard license header from another file at the top of the file
- Confirm the file isn't excluded from the check if it's generated or vendored
Example fix
// before (top of file)
fn main() {}
// 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
fn main() {} Defensive patterns
Strategy: validation
Validate before calling
const HEADER: &str = "// Copyright © SixtyFPS GmbH <info@slint.dev>\n// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-commercial";
let src = std::fs::read_to_string(path)?;
if !src.starts_with("// Copyright") {
panic!("{path}: missing license header");
} Type guard
fn has_license_header(src: &str) -> bool {
src.trim_start().starts_with("// Copyright")
&& src.contains("SPDX-License-Identifier:")
} Prevention
- Configure your editor/IDE file templates to insert the license header on new files
- Copy an existing file as a starting point when adding new sources
- Run `cargo xtask check` before committing new files
- Register the header in tools like cargo-new templates or snippets
When it happens
Trigger: Adding a new .rs/.slint/.cpp file without copying the license header; running `cargo xtask check` (no --fix) so the auto-fix branch (which would insert EXPECTED_HEADER) is skipped.
Common situations: Newly created files by IDE templates; generated files copied into the repo; contributors unaware of the header requirement.
Understand the failure class
Background: "--flag is required" and "must specify" CLI errors: how missing-required-flag validation works and how to fix it — this error's family across 20 libraries.
Related errors
- unexpected header. expected
- 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/e1dd475f363446ce.
Report an issue: GitHub.
Appendix: source
Thrown at xtask/src/license_headers_check.rs:982
Err(anyhow!("Encountered one or multiple errors. See above for details.").into())
} else {
println!("All files are ok.");
Ok(())
}
}
fn check_file_tags(&self, path: &Path, style: &LicenseTagStyle, license: &str) -> Result<()> {
let source = &std::fs::read_to_string(path).context("Error reading file")?;
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)?;View on GitHub (pinned to 3a7e700487)