slint-ui/slint · error

LICENSE symlink " " does not point to a file

Error message

LICENSE symlink "{}" does not point to a file

What it means

The final canonicalized target must be a regular file. This bail fires when the symlink resolves to a directory or something that is not a file under the top-level LICENSES/ path — for instance the LICENSES directory itself. In fix mode the offending link is removed and recreated.

Solutions

  1. Recreate the symlink including the exact license filename, e.g. `ln -sf ../../LICENSES/MIT.txt package/LICENSES/MIT.txt`
  2. Run `cargo xtask reuse-compliance-check --fix-symlinks` to replace the bad link automatically

Example fix

// before
package/LICENSES/MIT.txt -> ../../LICENSES/
// after
package/LICENSES/MIT.txt -> ../../LICENSES/MIT.txt
Defensive patterns

Strategy: validation

Validate before calling

for link in license_symlinks {
    let target = link.parent().unwrap().join(std::fs::read_link(link)?);
    let canon = std::fs::canonicalize(&target)?;
    if !canon.is_file() { eprintln!("target not a file: {}", canon.display()); }
}

Type guard

fn symlink_targets_file(link: &std::path::Path) -> bool {
    link.parent().and_then(|p| std::fs::read_link(link).ok().map(|t| p.join(t))).and_then(|p| std::fs::canonicalize(p).ok()).map(|c| c.is_file()).unwrap_or(false)
}

Try / catch

if let Err(e) = run_check() {
    if e.to_string().contains("does not point to a file") { /* include the license filename in the symlink target */ }
    else { return Err(e); }
}

Prevention

When it happens

Trigger: A sub-LICENSES symlink whose canonicalized target is a directory (e.g. points to ../LICENSES/ without a filename) or a non-regular file, checked without --fix-symlinks.

Common situations: Symlink accidentally created without the filename component; target name case-mismatching a directory; symlink to a fifo/device in unusual setups.

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/978f0297a8a9d31c. Report an issue: GitHub.

Appendix: source

Thrown at xtask/src/reuse_compliance_check.rs:243

        if !validated_link_target.starts_with(top_dir.join("LICENSES")) {
            if !fix_it {
                let c = child.to_string_lossy();
                anyhow::bail!(
                    "LICENSE symlink \"{}\" points to a random place in the repository",
                    c
                );
            } else {
                to_remove.push(child.clone());
                to_add.push(file_stem.clone());
                continue;
            }
        }

        if !validated_link_target.is_file() {
            if !fix_it {
                let c = child.to_string_lossy();
                anyhow::bail!("LICENSE symlink \"{}\" does not point to a file", c);
            } else {
                to_remove.push(child.clone());
                to_add.push(file_stem.clone());
                continue;
            }
        }
    }

    if !fix_it {
        return Ok(());
    }

    // Remove old symlinks
    for rm in to_remove {
        println!("Removing symlink \"{}\"...", rm.to_string_lossy());
        std::fs::remove_file(&rm).with_context(|| {
            format!("Failed to remove LICENSE symlink \"{}\"", rm.to_string_lossy())
        })?;

View on GitHub (pinned to bb937076de)