{"record":{"id":"5db4a59933db4531","repo":"Hmbown/CodeWhale","slug":"owned-skill-parent-does-not-exist","errorCode":null,"errorMessage":"owned skill parent {} does not exist","messagePattern":"owned skill parent (.+?) does not exist","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/skills/mutation.rs","lineNumber":191,"sourceCode":"        bail!(\n            \"refusing to mutate non-canonical Codewhale skills root {}\",\n            skills_dir.display()\n        );\n    }\n\n    let anchor_exists = checked_real_directory(anchor)?;\n    if !anchor_exists {\n        if require_existing {\n            bail!(\"owned skill anchor {} does not exist\", anchor.display());\n        }\n        return Ok(());\n    }\n\n    let codewhale_dir = anchor.join(\".codewhale\");\n    let codewhale_exists = checked_real_directory(&codewhale_dir)?;\n    if !codewhale_exists {\n        if require_existing {\n            bail!(\n                \"owned skill parent {} does not exist\",\n                codewhale_dir.display()\n            );\n        }\n        return Ok(());\n    }\n\n    let skills_exists = checked_real_directory(skills_dir)?;\n    if !skills_exists {\n        if require_existing {\n            bail!(\"owned skill root {} does not exist\", skills_dir.display());\n        }\n        return Ok(());\n    }\n\n    let canonical_anchor = fs::canonicalize(anchor)\n        .with_context(|| format!(\"failed to resolve owned anchor {}\", anchor.display()))?;\n    let canonical_skills = fs::canonicalize(skills_dir).with_context(|| {","sourceCodeStart":173,"sourceCodeEnd":209,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/skills/mutation.rs#L173-L209","documentation":"After confirming the anchor exists, validate_owned_target_chain checks the <anchor>/.codewhale parent directory; with require_existing=true, a missing .codewhale directory is an error instead of being silently created, keeping owned-root bootstrap explicit.","triggerScenarios":"Skill install/import against an existing anchor whose .codewhale subdirectory has not been created yet, via any caller that sets require_existing (install_remote, import_external, prepare_owned_target, resolve_owned_target, validate_owned_root_descriptor).","commonSituations":"First run in a project after deleting .codewhale; manual cleanup removed the state directory; anchor exists (e.g. home dir) but CodeWhale was never initialized there.","solutions":["Initialize CodeWhale in the anchor so .codewhale is created","Create the directory explicitly: mkdir <anchor>/.codewhale","Call the setup path without require_existing so the chain is bootstrapped legitimately"],"exampleFix":"// before\ninstall_remote(anchor, \"skill\") // .codewhale never created\n// after\nstd::fs::create_dir_all(anchor.join(\".codewhale\")).unwrap();\ninstall_remote(anchor, \"skill\")","handlingStrategy":"validation","validationCode":"let cw = anchor.join(\".codewhale\");\nassert!(cw.is_dir(), \"{} must exist; run CodeWhale init or mkdir it\", cw.display());","typeGuard":"fn codewhale_dir_exists(anchor: &Path) -> bool {\n    std::fs::metadata(anchor.join(\".codewhale\")).map(|m| m.is_dir()).unwrap_or(false)\n}","tryCatchPattern":"match install_remote(anchor, name) {\n    Err(e) if e.to_string().contains(\"owned skill parent\") => eprintln!(\"run CodeWhale init (or mkdir <anchor>/.codewhale) before installing\"),\n    other => other?,\n}","preventionTips":["Run the initializer after deleting .codewhale manually","Don't clean .codewhale without re-initializing before the next install","Check for <anchor>/.codewhale existence in setup scripts"],"tags":["skills","filesystem","directory"],"backgroundTag":"directory-not-found","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"}