{"record":{"id":"806dedc97c957634","repo":"Hmbown/CodeWhale","slug":"refusing-to-mutate-non-owned-root","errorCode":null,"errorMessage":"refusing to mutate non-owned root {}","messagePattern":"refusing to mutate non-owned root (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/tui/src/skills/mutation.rs","lineNumber":264,"sourceCode":"    if !checked_real_directory(anchor)? {\n        bail!(\"owned skill anchor {} does not exist\", anchor.display());\n    }\n\n    let codewhale_dir = anchor.join(\".codewhale\");\n    if !checked_real_directory(&codewhale_dir)? {\n        create_owned_directory(&codewhale_dir)?;\n    }\n    validate_owned_target_chain(anchor, &skills_dir, false)?;\n    if !checked_real_directory(&skills_dir)? {\n        create_owned_directory(&skills_dir)?;\n    }\n    validate_owned_target_chain(anchor, &skills_dir, true)?;\n    Ok(skills_dir)\n}\n\nfn 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(),","sourceCodeStart":246,"sourceCodeEnd":282,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/0c42157ee52f9d55af2b506d71b46249910f77d3/crates/tui/src/skills/mutation.rs#L246-L282","documentation":"target_scope_for_root only permits roots marked writable-owned (CodeWhaleProject or CodeWhaleGlobal kinds); this bail fires for any other root descriptor passed to a mutation. It means the operation was aimed at an external/harness-managed skills directory (e.g. a compatible external root), which CodeWhale deliberately never writes to. The non-owned root path is the input at fault.","triggerScenarios":"Thrown at crates/tui/src/skills/mutation.rs:264 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Target a CodeWhale-owned project or global skills root instead of the external one","Import the skill into an owned root first, then mutate it there","Point the command at the correct root descriptor"],"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-14T00:17:10.932Z"}