Hmbown/CodeWhale · error · anyhow::Error

owned skill root {} escapes anchor {}

Error message

owned skill root {} escapes anchor {}

What it means

After canonicalization, validate_owned_target_chain checks that the real (symlink-resolved) skills root is still inside the real anchor. This bail fires when they diverge — meaning some component (usually a symlink introduced after the lexical checks) redirects the skills root outside the anchor. It is a defense-in-depth traversal check: the canonical skills path escaping the canonical anchor is the fault condition.

Source

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

    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(|| {
        format!(
            "failed to resolve owned skill root {}",
            skills_dir.display()
        )
    })?;
    if !canonical_skills.starts_with(&canonical_anchor) {
        bail!(
            "owned skill root {} escapes anchor {}",
            skills_dir.display(),
            anchor.display()
        );
    }
    Ok(())
}

fn create_owned_directory(path: &Path) -> Result<()> {
    match fs::create_dir(path) {
        Ok(()) => {}
        Err(err) if err.kind() == ErrorKind::AlreadyExists => {}
        Err(err) => {
            return Err(err).with_context(|| format!("failed to create {}", path.display()));
        }
    }
    if !checked_real_directory(path)? {
        bail!("failed to create owned skill directory {}", path.display());

View on GitHub (pinned to 0c42157ee5)

Solutions

  1. Look for symlinks introduced inside .codewhale or skills and remove them
  2. Restore the canonical layout: anchor/.codewhale/skills as real directories
  3. Re-scan skills after repairing the directory structure
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/tui/src/skills/mutation.rs:216 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of Hmbown/CodeWhale@0c42157ee5 (2026-08-20). Data as JSON: /api/errors/a99ceaf92d0c3f97. Report an issue: GitHub.