{"record":{"id":"30a80e2f851a2291","repo":"Hmbown/CodeWhale","slug":"invalid-on-disk-package-directory-for-skill","errorCode":null,"errorMessage":"invalid on-disk package directory for skill '{}'","messagePattern":"invalid on-disk package directory for skill '(.+?)'","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/skills/mutation.rs","lineNumber":547,"sourceCode":"        .into_iter()\n        .find(|s| &s.id == skill_id)\n        .with_context(|| format!(\"audited skill {} not found\", skill_id.canonical_name))?;\n    let path = skill.root.path.join(&skill.id.relative_dir);\n    Ok((skill, path))\n}\n\n/// Directory segment under the skills root. Prefer this over `canonical_name`\n/// when calling install helpers that join `skills_dir / name` — installs use\n/// raw frontmatter names, while audit stores a normalized lookup key.\nfn on_disk_package_name(skill_id: &AuditedSkillId) -> Result<&str> {\n    let mut components = skill_id.relative_dir.components();\n    let name = match (components.next(), components.next()) {\n        (Some(Component::Normal(name)), None) => name.to_str(),\n        _ => None,\n    }\n    .filter(|name| !name.is_empty())\n    .ok_or_else(|| {\n        anyhow::anyhow!(\n            \"invalid on-disk package directory for skill '{}'\",\n            skill_id.canonical_name\n        )\n    })?;\n    Ok(name)\n}\n\nfn verify_expected_digest(path: &Path, expected: Option<&str>) -> Result<Option<String>> {\n    let current = package_digest::compute_package_digest(path)\n        .with_context(|| format!(\"cannot digest {}\", path.display()))?;\n    if let Some(expected) = expected\n        && expected != current\n    {\n        bail!(\n            \"skill content changed since audit (expected {expected}, found {current}); \\\n             re-review before mutating\"\n        );\n    }","sourceCodeStart":529,"sourceCodeEnd":565,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/skills/mutation.rs#L529-L565","documentation":"on_disk_package_name derives the package directory name from a skill's on-disk path and expects exactly one normal path component. If the path has a different shape (empty, nested, non-UTF8, or a special component), it errors citing the skill's canonical name.","triggerScenarios":"validate_owned_skill_path, import_external, update_skill, or remove_skill receives a skill directory path whose final component is not a single normal directory name — e.g. skill root itself, symlink/.. components, or non-UTF8 names.","commonSituations":"Pointing a skill at a drive/root or nested multi-level package path; a skill id whose canonical name maps to an odd path; filesystem with non-UTF8 directory names.","solutions":["Ensure the skill lives in exactly one plain directory directly under the skills root","Remove symlinks or '..' segments from the path","Rename the package directory to a plain UTF-8 name","Reinstall the skill rather than hand-moving its directory"],"exampleFix":"// before: nested package path\nskills/my-skill/v2/SKILL.md\n// after\nskills/my-skill/SKILL.md","handlingStrategy":"validation","validationCode":"fn is_simple_dir_name(p: &std::path::Path) -> bool {\n    matches!(p.components().next(), Some(std::path::Component::Normal(_)))\n        && p.components().count() == 1\n        && p.to_str().map_or(false, |s| !s.is_empty())\n}","typeGuard":null,"tryCatchPattern":"match import_external(path) {\n    Ok(skill) => /* use */,\n    Err(e) if e.to_string().contains(\"invalid on-disk package directory\") => eprintln!(\"place the skill in a single plain directory under the skills root\"),\n    Err(e) => return Err(e),\n}","preventionTips":["Keep one skill per single-level directory under the skills root","Avoid symlinks and '..' in skill paths","Use plain UTF-8 directory names"],"tags":["skills","filesystem","path"],"backgroundTag":"invalid-identifier-format","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}