Hmbown/CodeWhale · error

owned skill parent does not exist

Error message

owned skill parent {} does not exist

What it means

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.

Solutions

  1. Initialize CodeWhale in the anchor so .codewhale is created
  2. Create the directory explicitly: mkdir <anchor>/.codewhale
  3. Call the setup path without require_existing so the chain is bootstrapped legitimately

Example fix

// before
install_remote(anchor, "skill") // .codewhale never created
// after
std::fs::create_dir_all(anchor.join(".codewhale")).unwrap();
install_remote(anchor, "skill")
Defensive patterns

Strategy: validation

Validate before calling

let cw = anchor.join(".codewhale");
assert!(cw.is_dir(), "{} must exist; run CodeWhale init or mkdir it", cw.display());

Type guard

fn codewhale_dir_exists(anchor: &Path) -> bool {
    std::fs::metadata(anchor.join(".codewhale")).map(|m| m.is_dir()).unwrap_or(false)
}

Try / catch

match install_remote(anchor, name) {
    Err(e) if e.to_string().contains("owned skill parent") => eprintln!("run CodeWhale init (or mkdir <anchor>/.codewhale) before installing"),
    other => other?,
}

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Related errors


AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22). Data as JSON: /api/errors/5db4a59933db4531. Report an issue: GitHub.

Appendix: source

Thrown at crates/tui/src/skills/mutation.rs:191

        bail!(
            "refusing to mutate non-canonical Codewhale skills root {}",
            skills_dir.display()
        );
    }

    let anchor_exists = checked_real_directory(anchor)?;
    if !anchor_exists {
        if require_existing {
            bail!("owned skill anchor {} does not exist", anchor.display());
        }
        return Ok(());
    }

    let codewhale_dir = anchor.join(".codewhale");
    let codewhale_exists = checked_real_directory(&codewhale_dir)?;
    if !codewhale_exists {
        if require_existing {
            bail!(
                "owned skill parent {} does not exist",
                codewhale_dir.display()
            );
        }
        return Ok(());
    }

    let skills_exists = checked_real_directory(skills_dir)?;
    if !skills_exists {
        if require_existing {
            bail!("owned skill root {} does not exist", skills_dir.display());
        }
        return Ok(());
    }

    let canonical_anchor = fs::canonicalize(anchor)
        .with_context(|| format!("failed to resolve owned anchor {}", anchor.display()))?;
    let canonical_skills = fs::canonicalize(skills_dir).with_context(|| {

View on GitHub (pinned to 73e0f67d83)