slint-ui/slint · error

License symlink " " does not point to any existing location

Error message

License symlink "{}" does not point to any existing location

What it means

After reading a symlink's target, the code canonicalizes lic_dir.join(target); if canonicalization fails, the result is empty and this bail fires (non-fix mode), meaning the symlink is dangling — its target path does not exist. In fix mode the broken link is removed and recreated from the license map instead.

Solutions

  1. Fix the symlink to point at the existing top-level LICENSES file, e.g. `ln -sf ../../../LICENSES/Apache-2.0.txt package/LICENSES/Apache-2.0.txt`
  2. Run `cargo xtask reuse-compliance-check --fix-symlinks` to remove and recreate the broken links automatically
  3. Verify the target exists: `ls LICENSES/Apache-2.0.txt` and confirm the number of `../` components matches the subdirectory depth

Example fix

// before
package/LICENSES/Apache-2.0.txt -> ../../../LICENSES/Apache-2.0.txt  (LICENSES/Apache-2.0.txt missing)
// after
cd package/LICENSES && ln -sf ../../LICENSES/Apache-2.0.txt Apache-2.0.txt
Defensive patterns

Strategy: validation

Validate before calling

for link in license_symlinks {
    let target = std::fs::read_link(link)?;
    let full = link.parent().unwrap().join(&target);
    if std::fs::canonicalize(&full).is_err() {
        eprintln!("dangling symlink: {} -> {}", link.display(), target.display());
    }
}

Type guard

fn symlink_target_exists(link: &std::path::Path) -> bool {
    std::fs::read_link(link).ok().and_then(|t| link.parent().map(|p| p.join(t))).and_then(|p| std::fs::canonicalize(p).ok()).is_some()
}

Try / catch

if let Err(e) = run_check() {
    if e.to_string().contains("does not point to any existing location") { /* fix path depth or re-add missing LICENSES file */ }
    else { return Err(e); }
}

Prevention

When it happens

Trigger: validate_license_directory reads a symlink whose target resolves to a non-existent path: e.g. a symlink created before the top-level LICENSES file was committed, a typo in the relative path, or the target was deleted/renamed.

Common situations: Target license file removed from top-level LICENSES/ but sub-symlinks not updated; relative path depth wrong (wrong number of ../); symlink created on a system where it got mangled; case-sensitive filesystem mismatch.

Understand the failure class

Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.

Related errors


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

Appendix: source

Thrown at xtask/src/reuse_compliance_check.rs:192

                anyhow::bail!("LICENSE symlink \"{}\" is not necessary", child.to_string_lossy());
            } else {
                to_remove.push(child.clone());
                continue;
            }
        } else {
            linked_licenses.push(file_stem.clone());
        }

        let link_target = std::fs::read_link(&child).with_context(|| {
            format!("Could not extract link target of \"{}\"", child.to_string_lossy())
        })?;
        let link_target_file_stem = link_target.file_stem().unwrap_or_default().to_string_lossy();
        let link_target_extension = link_target.extension().unwrap_or_default();

        let validated_link_target = lic_dir.join(&link_target).canonicalize().unwrap_or_default();
        if validated_link_target.as_os_str().is_empty() {
            if !fix_it {
                anyhow::bail!(
                    "License symlink \"{}\" does not point to any existing location",
                    child.to_string_lossy()
                );
            }
            // Path validation failed
            to_remove.push(child.clone());
            to_add.push(file_stem.clone());
            continue;
        }
        if link_target_extension != ext || link_target_file_stem != file_stem {
            if !fix_it {
                anyhow::bail!(
                    "LICENSE symlink \"{}\" renames the license.",
                    child.to_string_lossy()
                );
            } else {
                to_remove.push(child.clone());
                to_add.push(file_stem.clone());

View on GitHub (pinned to bb937076de)