{"record":{"id":"4d0b3eb4a4232dd7","repo":"slint-ui/slint","slug":"unexpected-header-expected-found","errorCode":null,"errorMessage":"unexpected header.\nexpected: {}\nfound: {}","messagePattern":"unexpected header\\.\nexpected: (.+?)\nfound: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"xtask/src/license_headers_check.rs","lineNumber":991,"sourceCode":"\n        let source = SourceFileWithTags::new(source, style);\n\n        if !source.has_tag() {\n            if self.fix_it {\n                eprintln!(\"Fixing up {path:?} as instructed. It's missing a license header.\");\n                let source = source.replace_tag(&EXPECTED_HEADER, license);\n                std::fs::write(path, source).context(\"Error writing source\")\n            } else {\n                Err(anyhow!(\"Missing tag\"))\n            }\n        } else if source.tag_matches(&EXPECTED_HEADER, license) {\n            Ok(())\n        } else if self.fix_it {\n            eprintln!(\"Fixing up {path:?} as instructed. It has a wrong license header.\");\n            let source = source.replace_tag(&EXPECTED_HEADER, license);\n            std::fs::write(path, source).context(\"Error writing new source\")\n        } else {\n            Err(anyhow!(\n                \"unexpected header.\\nexpected: {}\\nfound: {}\",\n                EXPECTED_HEADER.to_string(style, license),\n                source.found_tag()\n            ))\n        }\n    }\n\n    fn check_cargo_toml(&self, path: &Path, license: &str) -> Result<()> {\n        let mut doc = CargoToml::new(path)?;\n\n        if doc.is_workspace() {\n            let mut wv = self.workspace_version.borrow_mut();\n            if (*wv).is_empty() {\n                *wv = doc.workspace_version()?.to_string();\n            }\n            let expected_version = wv.clone();\n\n            // Check the workspace.dependencies:","sourceCodeStart":973,"sourceCodeEnd":1009,"githubUrl":"https://github.com/slint-ui/slint/blob/3a7e700487dc74d404cad0726378053ab763d4e0/xtask/src/license_headers_check.rs#L973-L1009","documentation":"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.","triggerScenarios":"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.","commonSituations":"License policy change leaving stale headers; copying a header from another project; reformatting tools mangling the header; an import from a fork.","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)"],"exampleFix":"// before\n// SPDX-License-Identifier: MIT\n// after\n// 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","handlingStrategy":"validation","validationCode":"let src = std::fs::read_to_string(path)?;\nlet expected = \"// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-commercial\";\nif !src.contains(expected) {\n    panic!(\"{path}: wrong SPDX header, expected {expected}\");\n}","typeGuard":"fn header_matches(src: &str, expected: &str) -> bool {\n    src.lines().take(5).any(|l| l.trim() == expected)\n}","tryCatchPattern":null,"preventionTips":["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"],"tags":["license","spdx","header","ci"],"backgroundTag":"schema-validation-failed","analyzedSha":"3a7e700487dc74d404cad0726378053ab763d4e0","analyzedAt":"2026-09-16T01:37:20.251Z","contentChangedAt":"2026-09-16T01:37:20.251Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}