{"record":{"id":"73a313a03d368484","repo":"slint-ui/slint","slug":"not-all-licenses-were-found-in-top-level-licenses-directory","errorCode":null,"errorMessage":"Not all licenses were found in top level LICENSES directory","messagePattern":"Not all licenses were found in top level LICENSES directory","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"xtask/src/reuse_compliance_check.rs","lineNumber":287,"sourceCode":"    }\n\n    let mut license_filenames_to_add = Vec::new();\n\n    if !to_add.is_empty() {\n        let top_lic = PathBuf::from(\"LICENSES\");\n        for l in top_lic.read_dir().context(\"Failed to read the top level LICENSES directory\")? {\n            let path =\n                l.context(\"Failed to read an entry in the top level LICENSES directory\")?.path();\n            if path.is_file() {\n                let file_stem = path.file_stem().unwrap_or_default().to_string_lossy().to_string();\n                if to_add.contains(&file_stem) {\n                    license_filenames_to_add.push(path.file_name().unwrap_or_default().to_owned());\n                }\n            }\n        }\n    }\n    if license_filenames_to_add.len() != to_add.len() {\n        anyhow::bail!(\"Not all licenses were found in top level LICENSES directory\");\n    }\n\n    for license_file in license_filenames_to_add {\n        // build symlink target path\n        let mut target_link_path = PathBuf::new();\n\n        for _ in 0..lic_dir.components().count() - top_dir.components().count() {\n            target_link_path = target_link_path.join(\"..\");\n        }\n        target_link_path = target_link_path.join(\"LICENSES\");\n        target_link_path = target_link_path.join(&license_file);\n\n        let source_path = lic_dir.join(&license_file);\n\n        println!(\n            \"Creating LICENSE symlink {} -> {}\",\n            source_path.to_string_lossy(),\n            target_link_path.to_string_lossy()","sourceCodeStart":269,"sourceCodeEnd":305,"githubUrl":"https://github.com/slint-ui/slint/blob/bb937076de3f7919766c1f25e2e969367cf77e9a/xtask/src/reuse_compliance_check.rs#L269-L305","documentation":"In fix mode, after determining which licenses need new symlinks (to_add), the tool searches the top-level LICENSES/ directory for matching file stems. If the number of found files does not match the number of licenses to add, some license files are missing from the root LICENSES directory, and this bail aborts before creating partial symlinks.","triggerScenarios":"Running with --fix-symlinks when a license identifier reported by the SPDX/reuse data (or from removed bad symlinks) has no corresponding file with a matching file stem in ./LICENSES/ — e.g. license `GPL-3.0-only` used in code but LICENSES/ only contains GPL-3.0.txt.","commonSituations":"New dependency or code introduced a license not yet downloaded to LICENSES/; SPDX expression uses a different spelling (GPL-3.0-only vs GPL-3.0) than the file stem; top-level LICENSES/ dir not committed.","solutions":["Add the missing license text file to the top-level LICENSES/ directory, named exactly <LicenseId>.<ext> (e.g. LICENSES/GPL-3.0-only.txt)","Re-run with `--download-missing-licenses` (reuse download) so missing license texts are fetched automatically","Align SPDX identifiers in code/REUSE.toml with the file stems present in LICENSES/"],"exampleFix":"// before\nLICENSES/ contains only Apache-2.0.txt; code uses MIT\n// after\nreuse download MIT  (or manually add LICENSES/MIT.txt), then rerun xtask","handlingStrategy":"validation","validationCode":"let stems: HashSet<String> = std::fs::read_dir(\"LICENSES\")?.filter_map(|e| e.ok()).filter(|e| e.path().is_file()).filter_map(|e| e.path().file_stem()?.to_str().map(str::to_string)).collect();\nlet missing: Vec<_> = licenses_needed.iter().filter(|l| !stems.contains(*l)).collect();\nif !missing.is_empty() { eprintln!(\"missing in LICENSES/: {:?}\", missing); }","typeGuard":null,"tryCatchPattern":"if let Err(e) = run_fix() {\n    if e.to_string().contains(\"Not all licenses were found\") { /* add missing LICENSES/<Id>.txt or run with --download-missing-licenses */ }\n    else { return Err(e); }\n}","preventionTips":["Whenever introducing a new SPDX license identifier, immediately add its text to the root LICENSES/ dir","Use `cargo xtask reuse-compliance-check --download-missing-licenses` to fetch missing texts automatically","Keep SPDX identifiers in code/REUSE.toml consistent with LICENSES/ file stems"],"tags":["reuse","licensing","spdx","missing-file"],"backgroundTag":"resource-not-found","analyzedSha":"bb937076de3f7919766c1f25e2e969367cf77e9a","analyzedAt":"2026-09-16T01:37:20.251Z","contentChangedAt":"2026-09-16T01:37:20.251Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}