slint-ui/slint · error

points to , expected

Error message

{:?} points to {:?}, expected {:?}

What it means

The xtask license-header check found an existing LICENSE symlink in a crate directory whose target does not match the expected shared LICENSE file. Slint keeps a single top-level LICENSE file and symlinks it into every crate directory; a divergent symlink means the crate would ship a different (or stale) license than the rest of the repository. The check aborts so the wrong link is not silently rewritten without the `--fix` instruction that would have allowed removal and recreation.

Solutions

  1. Remove the incorrect symlink and recreate it pointing at the expected relative target (e.g. `ln -sfn ../../LICENSE <crate>/LICENSE`).
  2. Re-run the xtask task with the fix-up instruction so the tool removes and recreates the symlink automatically (the code path above removes wrong symlinks when fixing is enabled).
  3. Verify no tooling (editor, package manager, CI checkout) is converting symlinks into regular files or absolute links, then restore the relative symlink.

Example fix

// before (wrong target)
$ ls -l crates/foo/LICENSE
LICENSE -> /abs/path/slint/LICENSE
// after
$ rm crates/foo/LICENSE && ln -s ../../LICENSE crates/foo/LICENSE
Defensive patterns

Strategy: validation

Validate before calling

const target = fs.readlinkSync('crates/foo/LICENSE');
if (target !== '../../LICENSE') throw new Error(`bad LICENSE target: ${target}`);

Prevention

When it happens

Trigger: Running `cargo xtask` tasks that invoke check_cargo_toml -> check_licenses_dir when a crate's LICENSE symlink already exists but resolves to a path other than the expected relative target (e.g. `../../LICENSE`), typically after reorganizing directories or recreating the link manually with the wrong path.

Common situations: Moving/renaming a crate without updating its symlink; manually recreating the symlink by absolute path instead of the expected relative path; OS or tooling that copies files instead of preserving symlinks (e.g. on Windows or via some archive extraction); merge conflicts resolved by re-pointing the link incorrectly.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


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

Appendix: source

Thrown at xtask/src/license_headers_check.rs:1126

            if let Ok(meta) = std::fs::symlink_metadata(&symlink_path) {
                if !meta.file_type().is_symlink() {
                    return Err(anyhow!("{:?} exists but is not a symlink", symlink_path));
                }
                let target = std::fs::read_link(&symlink_path)
                    .context("Cannot read LICENSE symlink target")?;
                if target == expected_target {
                    continue;
                }
                if self.fix_it {
                    eprintln!(
                        "Fixing up {:?} as instructed. Symlink points to wrong target.",
                        symlink_path
                    );
                    std::fs::remove_file(&symlink_path)
                        .context("Failed to remove incorrect symlink")?;
                } else {
                    return Err(anyhow!(
                        "{:?} points to {:?}, expected {:?}",
                        symlink_path,
                        target,
                        expected_target
                    ));
                }
            }

            if self.fix_it {
                eprintln!(
                    "Fixing up {:?} as instructed. Creating symlink -> {:?}.",
                    symlink_path, expected_target
                );
                #[cfg(unix)]
                std::os::unix::fs::symlink(&expected_target, &symlink_path)
                    .context("Failed to create LICENSE symlink")?;
                #[cfg(windows)]
                std::os::windows::fs::symlink_file(&expected_target, &symlink_path)

View on GitHub (pinned to 3a7e700487)