{"record":{"id":"df4bb17630192b70","repo":"Hmbown/CodeWhale","slug":"skill-has-multiple-owned-packages-in-the-targ","errorCode":null,"errorMessage":"skill '{}' has multiple owned packages in the target scope; remove or consolidate them before importing","messagePattern":"skill '(.+?)' has multiple owned packages in the target scope; remove or consolidate them before importing","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/tui/src/skills/mutation.rs","lineNumber":701,"sourceCode":"        .skills\n        .iter()\n        .filter(|s| s.id.canonical_name == source_id.canonical_name)\n        .filter(|s| s.root.kind == want_kind)\n        .collect();\n\n    // Prefer the on-disk directory of an existing same-scope package so we\n    // replace/reject against Hello_World rather than creating a parallel\n    // hello-world next to it.\n    let (dest, dest_segment) = match existing_in_target.as_slice() {\n        [] => {\n            let segment = source_id.canonical_name.clone();\n            (skills_dir.join(&segment), segment)\n        }\n        [only] => {\n            let segment = on_disk_package_name(&only.id)?.to_string();\n            (only.root.path.join(&only.id.relative_dir), segment)\n        }\n        _ => bail!(\n            \"skill '{}' has multiple owned packages in the target scope; \\\n             remove or consolidate them before importing\",\n            source_id.canonical_name\n        ),\n    };\n\n    let dest_exists = validate_owned_child(&skills_dir, &dest, false)?;\n    if dest_exists {\n        let existing = package_digest::compute_package_digest(&dest).ok();\n        if existing.as_deref() == Some(expected_digest.as_str()) {\n            return Ok(SkillMutationReceipt {\n                action: SkillActionKind::Import,\n                name: source_id.canonical_name.clone(),\n                scope: target.as_skill_scope(),\n                safe_target_path: safe_display_path(&dest, Some(ctx.workspace), ctx.home),\n                before_digest: before,\n                after_digest: existing,\n                outcome: SkillMutationOutcome::AlreadyPresent,","sourceCodeStart":683,"sourceCodeEnd":719,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/0c42157ee52f9d55af2b506d71b46249910f77d3/crates/tui/src/skills/mutation.rs#L683-L719","documentation":"Raised in import_external when the target scope already contains more than one owned package whose canonical name matches the source and whose root kind matches the requested target. With multiple ambiguous destinations the importer cannot decide which package to replace or reject against, so it aborts before touching the filesystem.","triggerScenarios":"Thrown at crates/tui/src/skills/mutation.rs:701 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Remove the duplicate owned packages in the target scope so exactly one remains","Consolidate the duplicate packages into a single directory with the canonical name","Then re-run the import, which will replace or reject against the single existing package"],"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"}