{"record":{"id":"c0071edbf92e161e","repo":"slint-ui/slint","slug":"missing-licenses-directory-for-published-crate","errorCode":null,"errorMessage":"Missing LICENSES directory for published crate {:?}","messagePattern":"Missing LICENSES directory for published crate (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"xtask/src/license_headers_check.rs","lineNumber":1095,"sourceCode":"                None => {\n                    return Err(anyhow!(\n                        \"No license file found in root LICENSES/ for SPDX id '{}'\",\n                        id\n                    ));\n                }\n            }\n        }\n\n        if !licenses_dir.exists() {\n            if self.fix_it {\n                eprintln!(\n                    \"Fixing up {:?} as instructed. Creating missing LICENSES directory.\",\n                    crate_dir\n                );\n                std::fs::create_dir(&licenses_dir)\n                    .context(\"Failed to create LICENSES directory\")?;\n            } else {\n                return Err(anyhow!(\n                    \"Missing LICENSES directory for published crate {:?}\",\n                    crate_dir\n                ));\n            }\n        }\n\n        // Compute relative path after directory exists so canonicalize works\n        let rel_prefix = diff_paths(&root_licenses, &licenses_dir);\n\n        for filename in &expected_filenames {\n            let symlink_path = licenses_dir.join(filename);\n            let expected_target = rel_prefix.join(filename);\n\n            if let Ok(meta) = std::fs::symlink_metadata(&symlink_path) {\n                if !meta.file_type().is_symlink() {\n                    return Err(anyhow!(\"{:?} exists but is not a symlink\", symlink_path));\n                }\n                let target = std::fs::read_link(&symlink_path)","sourceCodeStart":1077,"sourceCodeEnd":1113,"githubUrl":"https://github.com/slint-ui/slint/blob/3a7e700487dc74d404cad0726378053ab763d4e0/xtask/src/license_headers_check.rs#L1077-L1113","documentation":"For crates that are published, check_licenses_dir expects a LICENSES/ subdirectory in the crate directory containing symlinks to the license texts. If the directory doesn't exist and the check isn't in fix mode, this error is thrown.","triggerScenarios":"Running `cargo xtask check` (no --fix) on a publishable crate whose directory lacks a LICENSES/ folder; a new crate added without creating the directory.","commonSituations":"Scaffolding a new publishable crate; deleting LICENSES/ accidentally; moving a crate without copying its directory contents.","solutions":["Run `cargo xtask check --fix`, which creates the missing LICENSES directory (and symlinks)","Manually create <crate>/LICENSES/ and symlink the required license files, e.g. `ln -s ../../LICENSES/MIT.txt LICENSES/MIT.txt`","Ensure the crate directory was fully committed (LICENSES is symlinked content that git must track)"],"exampleFix":"# before\nmy-crate/Cargo.toml\nsrc/\n# after\nmkdir -p my-crate/LICENSES\nln -s ../../LICENSES/MIT.txt my-crate/LICENSES/MIT.txt","handlingStrategy":"validation","validationCode":"let is_published = /* from publish flag/workspace */ true;\nif is_published {\n    assert!(std::path::Path::new(\"my-crate/LICENSES\").is_dir(), \"missing LICENSES dir\");\n}","typeGuard":"fn licenses_dir_exists(crate_dir: &std::path::Path) -> bool {\n    crate_dir.join(\"LICENSES\").is_dir()\n}","tryCatchPattern":null,"preventionTips":["Include LICENSES/ symlinks whenever creating a publishable crate","Ensure git tracks symlinks (core.symlinks true) so clones keep them","Copy crates with symlink preservation (cp -a, tar -h off)","Run `cargo xtask check --fix` once after scaffolding a crate"],"tags":["license","spdx","packaging","ci"],"backgroundTag":"directory-not-found","analyzedSha":"3a7e700487dc74d404cad0726378053ab763d4e0","analyzedAt":"2026-09-16T01:37:20.251Z","contentChangedAt":"2026-09-16T01:37:20.251Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}