slint-ui/slint · error

Not all licenses were found in top level LICENSES directory

Error message

Not all licenses were found in top level LICENSES directory

What it means

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.

Solutions

  1. Add the missing license text file to the top-level LICENSES/ directory, named exactly <LicenseId>.<ext> (e.g. LICENSES/GPL-3.0-only.txt)
  2. Re-run with `--download-missing-licenses` (reuse download) so missing license texts are fetched automatically
  3. Align SPDX identifiers in code/REUSE.toml with the file stems present in LICENSES/

Example fix

// before
LICENSES/ contains only Apache-2.0.txt; code uses MIT
// after
reuse download MIT  (or manually add LICENSES/MIT.txt), then rerun xtask
Defensive patterns

Strategy: validation

Validate before calling

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();
let missing: Vec<_> = licenses_needed.iter().filter(|l| !stems.contains(*l)).collect();
if !missing.is_empty() { eprintln!("missing in LICENSES/: {:?}", missing); }

Try / catch

if let Err(e) = run_fix() {
    if e.to_string().contains("Not all licenses were found") { /* add missing LICENSES/<Id>.txt or run with --download-missing-licenses */ }
    else { return Err(e); }
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


AI-assisted analysis of slint-ui/slint@bb937076de (2026-09-16). Data as JSON: /api/errors/73a313a03d368484. Report an issue: GitHub.

Appendix: source

Thrown at xtask/src/reuse_compliance_check.rs:287

    }

    let mut license_filenames_to_add = Vec::new();

    if !to_add.is_empty() {
        let top_lic = PathBuf::from("LICENSES");
        for l in top_lic.read_dir().context("Failed to read the top level LICENSES directory")? {
            let path =
                l.context("Failed to read an entry in the top level LICENSES directory")?.path();
            if path.is_file() {
                let file_stem = path.file_stem().unwrap_or_default().to_string_lossy().to_string();
                if to_add.contains(&file_stem) {
                    license_filenames_to_add.push(path.file_name().unwrap_or_default().to_owned());
                }
            }
        }
    }
    if license_filenames_to_add.len() != to_add.len() {
        anyhow::bail!("Not all licenses were found in top level LICENSES directory");
    }

    for license_file in license_filenames_to_add {
        // build symlink target path
        let mut target_link_path = PathBuf::new();

        for _ in 0..lic_dir.components().count() - top_dir.components().count() {
            target_link_path = target_link_path.join("..");
        }
        target_link_path = target_link_path.join("LICENSES");
        target_link_path = target_link_path.join(&license_file);

        let source_path = lic_dir.join(&license_file);

        println!(
            "Creating LICENSE symlink {} -> {}",
            source_path.to_string_lossy(),
            target_link_path.to_string_lossy()

View on GitHub (pinned to bb937076de)