Hmbown/CodeWhale · error · anyhow::Error

refusing to mutate path {} outside direct owned root {}

Error message

refusing to mutate path {} outside direct owned root {}

What it means

validate_owned_child requires the target path to be a direct child of the validated owned skills root (child.parent() == skills_dir). This bail fires when the requested mutation path is nested deeper, sits in another directory, or is otherwise outside the owned root — a traversal/containment rejection. The out-of-root child path is the input at fault.

Source

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

    let target = target_scope_for_root(root)?;
    let expected = resolve_owned_target(ctx.workspace, ctx.home, target)?;
    if root.path != expected {
        bail!(
            "audited owned root {} does not match mutation target {}",
            root.path.display(),
            expected.display()
        );
    }
    let anchor = owned_anchor(ctx.workspace, ctx.home, target)?;
    validate_owned_target_chain(anchor, &expected, true)?;
    Ok(expected)
}

/// Validate a real direct child of an already validated owned skills root.
/// Returns false only when a missing child is permitted.
fn validate_owned_child(skills_dir: &Path, child: &Path, require_existing: bool) -> Result<bool> {
    if child.parent() != Some(skills_dir) {
        bail!(
            "refusing to mutate path {} outside direct owned root {}",
            child.display(),
            skills_dir.display()
        );
    }
    let exists = checked_real_directory(child)?;
    if !exists {
        if require_existing {
            bail!("owned skill path {} does not exist", child.display());
        }
        return Ok(false);
    }

    let canonical_root = fs::canonicalize(skills_dir).with_context(|| {
        format!(
            "failed to resolve owned skill root {}",
            skills_dir.display()
        )

View on GitHub (pinned to 0c42157ee5)

Solutions

  1. Pass the skill package directory directly under the owned skills root
  2. Check for typos or extra path segments in the target path
  3. Operate via skill name/id rather than a hand-built path so the correct child is derived
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/tui/src/skills/mutation.rs:295 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/1854ef27b9b538f2. Report an issue: GitHub.