slint-ui/slint · error

" " is not a directory

Error message

"{}" is not a directory

What it means

The xtask license-directory validator canonicalizes the repo's `LICENSES` directory and bails if the resulting path is not a directory. This catches a missing or wrongly-typed LICENSES location (e.g. a symlink or file standing in for it) before scanning license symlinks.

Solutions

  1. Ensure the repository contains a LICENSES directory at its root containing the license text files
  2. Fix or recreate the LICENSES entry if it is a dangling symlink or a regular file
  3. Run xtask from the repository root so the LICENSES path resolves correctly

Example fix

// before
LICENSES -> /nonexistent/target   (dangling symlink)
// after
LICENSES/  (real directory containing MIT.txt, GPL-3.0-only.txt, ...)
Defensive patterns

Strategy: validation

Validate before calling

test -d LICENSES || echo "LICENSES directory missing; restore it before running xtask"

Prevention

When it happens

Trigger: Running `validate_license_directory` (via scan_symlinks) in a checkout where `LICENSES/` is absent, is a regular file instead of a directory, or where canonicalization resolved a symlink to a non-directory target.

Common situations: Shallow/partial clones or archives that dropped the LICENSES directory; a broken symlink replacing LICENSES; running xtask from a workspace without the REUSE layout (or wrong working directory).

Related errors


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

Appendix: source

Thrown at xtask/src/reuse_compliance_check.rs:139

                break;
            }
        }
    }
}

fn is_symlink(path: &Path) -> bool {
    std::fs::symlink_metadata(path).is_ok_and(|m| m.file_type().is_symlink())
}

fn validate_license_directory(dir: &Path, licenses: &[String], fix_it: bool) -> Result<()> {
    let top_dir =
        PathBuf::from(".").canonicalize().context("Failed to canonicalize the top directory")?;
    let lic_dir = dir.join("LICENSES").canonicalize().with_context(|| {
        format!("Failed to canonicalize \"{}\"", dir.join("LICENSES").to_string_lossy())
    })?;

    if !lic_dir.is_dir() {
        anyhow::bail!("\"{}\" is not a directory", lic_dir.to_string_lossy());
    }

    let mut linked_licenses = Vec::new();
    let mut to_add = Vec::new();
    let mut to_remove = Vec::new();

    for d in lic_dir
        .read_dir()
        .with_context(|| format!("Failed to read \"{}\" directory", lic_dir.to_string_lossy()))?
    {
        let child = d
            .with_context(|| {
                format!("Failed to read in LICENSES directory \"{}\"", lic_dir.to_string_lossy())
            })?
            .path();

        if !is_symlink(&child) {
            if child.is_file() && fix_it {

View on GitHub (pinned to bb937076de)