Hmbown/CodeWhale · error · anyhow::Error
skill '{}' has multiple owned packages in the target scope;
Error message
skill '{}' has multiple owned packages in the target scope; remove or consolidate them before importing What it means
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.
Source
Thrown at crates/tui/src/skills/mutation.rs:701
.skills
.iter()
.filter(|s| s.id.canonical_name == source_id.canonical_name)
.filter(|s| s.root.kind == want_kind)
.collect();
// Prefer the on-disk directory of an existing same-scope package so we
// replace/reject against Hello_World rather than creating a parallel
// hello-world next to it.
let (dest, dest_segment) = match existing_in_target.as_slice() {
[] => {
let segment = source_id.canonical_name.clone();
(skills_dir.join(&segment), segment)
}
[only] => {
let segment = on_disk_package_name(&only.id)?.to_string();
(only.root.path.join(&only.id.relative_dir), segment)
}
_ => bail!(
"skill '{}' has multiple owned packages in the target scope; \
remove or consolidate them before importing",
source_id.canonical_name
),
};
let dest_exists = validate_owned_child(&skills_dir, &dest, false)?;
if dest_exists {
let existing = package_digest::compute_package_digest(&dest).ok();
if existing.as_deref() == Some(expected_digest.as_str()) {
return Ok(SkillMutationReceipt {
action: SkillActionKind::Import,
name: source_id.canonical_name.clone(),
scope: target.as_skill_scope(),
safe_target_path: safe_display_path(&dest, Some(ctx.workspace), ctx.home),
before_digest: before,
after_digest: existing,
outcome: SkillMutationOutcome::AlreadyPresent,View on GitHub (pinned to 0c42157ee5)
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
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/tui/src/skills/mutation.rs:701 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/df4bb17630192b70.
Report an issue: GitHub.