{"record":{"id":"ca0554bd830b5090","repo":"zeroclaw-labs/zeroclaw","slug":"cli-skills-agent-multiple-bundles","errorCode":"cli-skills-agent-multiple-bundles","errorMessage":"agent '{$alias}' has multiple skill bundles ({$bundles}); pass --bundle to choose one","messagePattern":"agent '(.+?)' has multiple skill bundles \\((.+?)\\); pass --bundle to choose one","errorType":"console","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src/skills/mod.rs","lineNumber":630,"sourceCode":"\n    // 3. Derive the destination from that agent's assigned bundles.\n    if let Some(alias) = target_agent.as_deref()\n        && let Some(agent_cfg) = config.agent(alias)\n    {\n        match agent_cfg.skill_bundles.as_slice() {\n            [one] => {\n                let dir =\n                    zeroclaw_config::skill_bundles::resolve_directory(config, &install_root, one)\n                        .map_err(anyhow::Error::msg)?;\n                return Ok(SkillLocation::Bundle {\n                    alias: one.clone(),\n                    dir,\n                });\n            }\n            [] => {} // no bundle assigned — fall through to the global dir\n            many => {\n                let bundles = many.join(\", \");\n                anyhow::bail!(\n                    \"{}\",\n                    get_required_cli_string_with_args(\n                        \"cli-skills-agent-multiple-bundles\",\n                        &[(\"alias\", alias), (\"bundles\", bundles.as_str())],\n                    )\n                );\n            }\n        }\n    }\n\n    // 4. Global fallback — installed but not auto-loaded (caller prints a note).\n    Ok(SkillLocation::Global {\n        dir: skills_dir(&config.data_dir),\n    })\n}\n\n/// Every location (bundle dirs + the global dir) that contains a skill named\n/// `name`, as `(label, skill-dir)` pairs. Bundle labels are `bundle:<alias>`;","sourceCodeStart":612,"sourceCodeEnd":648,"githubUrl":"https://github.com/zeroclaw-labs/zeroclaw/blob/88bb9c8533fc57ed7a03e36ca7c9ed2bf8336dcc/src/skills/mod.rs#L612-L648","documentation":"When `skills install` has no explicit --bundle, the destination comes from the target agent's assigned bundles — the explicit --agent, else the resolved active agent. If that agent's skill_bundles list holds two or more entries, no single destination can be chosen, so the install aborts naming the agent and its bundles. Only the exactly-one-bundle case auto-targets.","triggerScenarios":"An agent configured with skill_bundles = [\"work\", \"personal\"] running `skills install <src>` or `--agent <that-agent>`; adding a second bundle to an agent whose installs previously auto-targeted the first.","commonSituations":"Growing from one shared bundle to per-project bundles; team config templates that pre-assign multiple bundles to each agent.","solutions":["Pass --bundle <alias> to state the destination explicitly","Or trim the agent's skill_bundles list to exactly one entry in config","Or install with no targeting flags so it lands in the global skills dir","Pick the bundle whose skills the agent actually loads at runtime"],"exampleFix":"# before\n[agents.helper]\nskill_bundles = [\"work\", \"personal\"]\n# `zeroclaw skills install ./s` → error\n\n# after\n[agents.helper]\nskill_bundles = [\"work\"]","handlingStrategy":"validation","validationCode":"// Before installing without --bundle, ensure the target agent has exactly one bundle\nlet bundles = config.agent(target_alias).map(|a| a.skill_bundles.clone());\nmatch bundles.as_deref() {\n    Some([_one]) => { /* safe: auto-targets that bundle */ }\n    Some(many) if many.len() > 1 => eprintln!(\"pass --bundle; agent has {} bundles\", many.len()),\n    _ => { /* global fallback */ }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass --bundle in automated installs — never rely on single-bundle inference","When adding a second bundle to an agent, audit every script that installs skills for it","Keep one bundle per agent if you want hands-off install targeting"],"tags":["cli","skills","install","agent","bundles","ambiguity"],"backgroundTag":"ambiguous-reference","analyzedSha":"88bb9c8533fc57ed7a03e36ca7c9ed2bf8336dcc","analyzedAt":"2026-08-23T01:07:41.857Z","schemaVersion":2},"datasetVersion":"2026-08-23T08:06:27.607Z"}