{"record":{"id":"ea93c92c575de4b6","repo":"Hmbown/CodeWhale","slug":"audited-owned-root-does-not-match-mutation-targ","errorCode":null,"errorMessage":"audited owned root {} does not match mutation target {}","messagePattern":"audited owned root (.+?) does not match mutation target (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/tui/src/skills/mutation.rs","lineNumber":280,"sourceCode":"fn target_scope_for_root(root: &SkillRootDescriptor) -> Result<SkillTargetScope> {\n    if !root.is_writable_owned() {\n        bail!(\"refusing to mutate non-owned root {}\", root.path.display());\n    }\n    match root.kind {\n        SkillRootKind::CodeWhaleProject => Ok(SkillTargetScope::Project),\n        SkillRootKind::CodeWhaleGlobal => Ok(SkillTargetScope::Global),\n        _ => bail!(\"refusing to mutate non-owned root {}\", root.path.display()),\n    }\n}\n\nfn validate_owned_root_descriptor(\n    ctx: &MutationContext<'_>,\n    root: &SkillRootDescriptor,\n) -> Result<PathBuf> {\n    let target = target_scope_for_root(root)?;\n    let expected = resolve_owned_target(ctx.workspace, ctx.home, target)?;\n    if root.path != expected {\n        bail!(\n            \"audited owned root {} does not match mutation target {}\",\n            root.path.display(),\n            expected.display()\n        );\n    }\n    let anchor = owned_anchor(ctx.workspace, ctx.home, target)?;\n    validate_owned_target_chain(anchor, &expected, true)?;\n    Ok(expected)\n}\n\n/// Validate a real direct child of an already validated owned skills root.\n/// Returns false only when a missing child is permitted.\nfn validate_owned_child(skills_dir: &Path, child: &Path, require_existing: bool) -> Result<bool> {\n    if child.parent() != Some(skills_dir) {\n        bail!(\n            \"refusing to mutate path {} outside direct owned root {}\",\n            child.display(),\n            skills_dir.display()","sourceCodeStart":262,"sourceCodeEnd":298,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/0c42157ee52f9d55af2b506d71b46249910f77d3/crates/tui/src/skills/mutation.rs#L262-L298","documentation":"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.","triggerScenarios":"Thrown at crates/tui/src/skills/mutation.rs:280 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Re-run the skills scan/audit to refresh root descriptors before mutating","Verify the workspace or home directory has not changed since the audit","Retry the mutation from the current project/session so the audit matches the live root"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"0c42157ee52f9d55af2b506d71b46249910f77d3","analyzedAt":"2026-08-20T21:50:45.477Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}