Hmbown/CodeWhale · error

owned skill anchor does not exist

Error message

owned skill anchor {} does not exist

What it means

When require_existing is set, validate_owned_target_chain demands that the owned anchor directory already exist; a missing anchor is an error rather than an implicit creation, so installs never silently bootstrap directories in unexpected places.

Solutions

  1. Create the anchor directory first (e.g. mkdir -p <anchor>)
  2. Verify the configured anchor path points at the intended existing directory
  3. Run the initial CodeWhale setup/initialization so .codewhale scaffolding exists

Example fix

// before
install_remote("/nonexistent/project", "some-skill")
// after
fs::create_dir_all("/nonexistent/project")?; // or use the real project root
install_remote("/real/project", "some-skill")
Defensive patterns

Strategy: validation

Validate before calling

assert!(anchor.is_dir(), "anchor {} must exist before install", anchor.display());

Type guard

fn anchor_exists(p: &Path) -> bool {
    std::fs::metadata(p).map(|m| m.is_dir()).unwrap_or(false)
}

Try / catch

match install_remote(anchor, name) {
    Err(e) if e.to_string().contains("anchor") && e.to_string().contains("does not exist") => eprintln!("create or correct the anchor directory first"),
    other => other?,
}

Prevention

When it happens

Trigger: Calling install_remote/import_external (or prepare_owned_target/resolve_owned_target with require_existing=true) when the anchor directory (e.g. the project or home root that should contain .codewhale) does not exist on disk.

Common situations: Running against a freshly cloned project before any CodeWhale setup; a deleted or moved home/project directory; pointing configuration at a nonexistent anchor path.

Related errors


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

Appendix: source

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

/// Validate the complete owned-root chain without following a symlink in the
/// workspace/home anchor, `.codewhale`, or `skills` component.
fn validate_owned_target_chain(
    anchor: &Path,
    skills_dir: &Path,
    require_existing: bool,
) -> Result<()> {
    let expected = anchor.join(".codewhale").join("skills");
    if skills_dir != expected {
        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 {

View on GitHub (pinned to 73e0f67d83)