Hmbown/CodeWhale · error · anyhow::Error

audited owned root {} does not match mutation target {}

Error message

audited owned root {} does not match mutation target {}

What it means

validate_owned_root_descriptor compares the audited root path against the owned root freshly resolved from the current workspace/home. They differ, so the audit snapshot is out of date relative to the live environment (workspace moved, home changed, or descriptor forged/stale) and mutating would write to a location other than the one that was audited. The mismatched root.path is the input at fault.

Source

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

fn target_scope_for_root(root: &SkillRootDescriptor) -> Result<SkillTargetScope> {
    if !root.is_writable_owned() {
        bail!("refusing to mutate non-owned root {}", root.path.display());
    }
    match root.kind {
        SkillRootKind::CodeWhaleProject => Ok(SkillTargetScope::Project),
        SkillRootKind::CodeWhaleGlobal => Ok(SkillTargetScope::Global),
        _ => bail!("refusing to mutate non-owned root {}", root.path.display()),
    }
}

fn validate_owned_root_descriptor(
    ctx: &MutationContext<'_>,
    root: &SkillRootDescriptor,
) -> Result<PathBuf> {
    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()

View on GitHub (pinned to 0c42157ee5)

Solutions

  1. Re-run the skills scan/audit to refresh root descriptors before mutating
  2. Verify the workspace or home directory has not changed since the audit
  3. Retry the mutation from the current project/session so the audit matches the live root
Defensive patterns

Strategy: validation

When it happens

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