nikivdev/code · error
dependency action is not a package manager command
Error message
dependency action is not a package manager command
What it means
build_command translates a DepsAction into a concrete package-manager command, but only Install maps to one. Update, Repo, and Pick are handled by different code paths; reaching them here is an internal misuse and bails.
Source
Thrown at src/deps.rs:104
project_root: &Path,
action: &DepsAction,
) -> Result<(&'static str, Vec<String>)> {
let workspace = is_workspace(project_root);
let (base, mut args) = match (manager, workspace) {
(DepsManager::Pnpm, true) => ("pnpm", vec!["-r".to_string()]),
(DepsManager::Pnpm, false) => ("pnpm", Vec::new()),
(DepsManager::Yarn, _) => ("yarn", Vec::new()),
(DepsManager::Bun, _) => ("bun", Vec::new()),
(DepsManager::Npm, _) => ("npm", Vec::new()),
};
match action {
DepsAction::Install { args: extra } => {
args.push("install".to_string());
args.extend(extra.clone());
}
DepsAction::Update(_) | DepsAction::Repo { .. } | DepsAction::Pick => {
bail!("dependency action is not a package manager command");
}
}
Ok((base, args))
}
fn detect_manager(project_root: &Path) -> DepsManager {
if let Some(pm) = detect_manager_from_package_json(project_root) {
return pm;
}
if project_root.join("pnpm-lock.yaml").exists()
|| project_root.join("pnpm-workspace.yaml").exists()
{
return DepsManager::Pnpm;
}
if project_root.join("bun.lockb").exists() || project_root.join("bun.lock").exists() {
return DepsManager::Bun;
}View on GitHub (pinned to a747e741ae)
Solutions
- Fix the caller to route DepsAction::Update to build_commands (the planner) instead of build_command
- Use the correct CLI subcommand for the action (update/repo/pick have their own flows)
- If calling the library API, only pass DepsAction::Install to this code path
Example fix
// before
match action {
DepsAction::Update(_) => build_command(action, ctx)?, // wrong builder
_ => build_command(action, ctx)?,
}
// after
match action {
DepsAction::Update(_) => build_commands(target, opts)?,
_ => build_command(action, ctx)?,
} Defensive patterns
Strategy: type-guard
Validate before calling
// route actions correctly before calling
match action {
DepsAction::Install { .. } => build_command(action, ctx)?,
_ => return Err(anyhow!("use the planner path for non-install actions")),
} Type guard
fn is_install_action(a: &DepsAction) -> bool {
matches!(a, DepsAction::Install { .. })
} Prevention
- Use exhaustive match on DepsAction at the dispatch site
- Keep one code path per action variant; document which builder handles which
- Add a debug_assert!(is_install_action(&action)) in build_command
When it happens
Trigger: An internal caller dispatches DepsAction::Update, DepsAction::Repo{..}, or DepsAction::Pick through build_command (the Install-only command builder), i.e. a variant-routing bug, not a user-input error.
Common situations: Hitting this after a CLI refactor where subcommands route actions to the wrong builder; calling library internals directly with an unsupported action.
Related errors
- invalid js update target
- dependency command failed
- no dependency manifests found from {} up to {}
- dependency update command failed: {}
AI-assisted analysis of nikivdev/code@a747e741ae (2026-09-01).
Data as JSON: /api/errors/aa3ba2ef1f55f202.
Report an issue: GitHub.