{"record":{"id":"c061f8a32471cccd","repo":"slint-ui/slint","slug":"license-symlink-does-not-point-to-any-existing-location","errorCode":null,"errorMessage":"License symlink \"{}\" does not point to any existing location","messagePattern":"License symlink \"(.+?)\" does not point to any existing location","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"xtask/src/reuse_compliance_check.rs","lineNumber":192,"sourceCode":"                anyhow::bail!(\"LICENSE symlink \\\"{}\\\" is not necessary\", child.to_string_lossy());\n            } else {\n                to_remove.push(child.clone());\n                continue;\n            }\n        } else {\n            linked_licenses.push(file_stem.clone());\n        }\n\n        let link_target = std::fs::read_link(&child).with_context(|| {\n            format!(\"Could not extract link target of \\\"{}\\\"\", child.to_string_lossy())\n        })?;\n        let link_target_file_stem = link_target.file_stem().unwrap_or_default().to_string_lossy();\n        let link_target_extension = link_target.extension().unwrap_or_default();\n\n        let validated_link_target = lic_dir.join(&link_target).canonicalize().unwrap_or_default();\n        if validated_link_target.as_os_str().is_empty() {\n            if !fix_it {\n                anyhow::bail!(\n                    \"License symlink \\\"{}\\\" does not point to any existing location\",\n                    child.to_string_lossy()\n                );\n            }\n            // Path validation failed\n            to_remove.push(child.clone());\n            to_add.push(file_stem.clone());\n            continue;\n        }\n        if link_target_extension != ext || link_target_file_stem != file_stem {\n            if !fix_it {\n                anyhow::bail!(\n                    \"LICENSE symlink \\\"{}\\\" renames the license.\",\n                    child.to_string_lossy()\n                );\n            } else {\n                to_remove.push(child.clone());\n                to_add.push(file_stem.clone());","sourceCodeStart":174,"sourceCodeEnd":210,"githubUrl":"https://github.com/slint-ui/slint/blob/bb937076de3f7919766c1f25e2e969367cf77e9a/xtask/src/reuse_compliance_check.rs#L174-L210","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["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`","Run `cargo xtask reuse-compliance-check --fix-symlinks` to remove and recreate the broken links automatically","Verify the target exists: `ls LICENSES/Apache-2.0.txt` and confirm the number of `../` components matches the subdirectory depth"],"exampleFix":"// before\npackage/LICENSES/Apache-2.0.txt -> ../../../LICENSES/Apache-2.0.txt  (LICENSES/Apache-2.0.txt missing)\n// after\ncd package/LICENSES && ln -sf ../../LICENSES/Apache-2.0.txt Apache-2.0.txt","handlingStrategy":"validation","validationCode":"for link in license_symlinks {\n    let target = std::fs::read_link(link)?;\n    let full = link.parent().unwrap().join(&target);\n    if std::fs::canonicalize(&full).is_err() {\n        eprintln!(\"dangling symlink: {} -> {}\", link.display(), target.display());\n    }\n}","typeGuard":"fn symlink_target_exists(link: &std::path::Path) -> bool {\n    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()\n}","tryCatchPattern":"if let Err(e) = run_check() {\n    if e.to_string().contains(\"does not point to any existing location\") { /* fix path depth or re-add missing LICENSES file */ }\n    else { return Err(e); }\n}","preventionTips":["Create symlinks with relative targets of the correct ../ depth for the directory","Never delete a top-level LICENSES file without updating or regenerating sub-symlinks (use --fix-symlinks)","Run `find . -xtype l` to detect dangling symlinks in CI"],"tags":["reuse","symlink","broken-link","licensing"],"backgroundTag":"file-not-found","analyzedSha":"bb937076de3f7919766c1f25e2e969367cf77e9a","analyzedAt":"2026-09-16T01:37:20.251Z","contentChangedAt":"2026-09-16T01:37:20.251Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}