{"record":{"id":"aa3ba2ef1f55f202","repo":"nikivdev/code","slug":"dependency-action-is-not-a-package-manager-command","errorCode":null,"errorMessage":"dependency action is not a package manager command","messagePattern":"dependency action is not a package manager command","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/deps.rs","lineNumber":104,"sourceCode":"    project_root: &Path,\n    action: &DepsAction,\n) -> Result<(&'static str, Vec<String>)> {\n    let workspace = is_workspace(project_root);\n    let (base, mut args) = match (manager, workspace) {\n        (DepsManager::Pnpm, true) => (\"pnpm\", vec![\"-r\".to_string()]),\n        (DepsManager::Pnpm, false) => (\"pnpm\", Vec::new()),\n        (DepsManager::Yarn, _) => (\"yarn\", Vec::new()),\n        (DepsManager::Bun, _) => (\"bun\", Vec::new()),\n        (DepsManager::Npm, _) => (\"npm\", Vec::new()),\n    };\n\n    match action {\n        DepsAction::Install { args: extra } => {\n            args.push(\"install\".to_string());\n            args.extend(extra.clone());\n        }\n        DepsAction::Update(_) | DepsAction::Repo { .. } | DepsAction::Pick => {\n            bail!(\"dependency action is not a package manager command\");\n        }\n    }\n\n    Ok((base, args))\n}\n\nfn detect_manager(project_root: &Path) -> DepsManager {\n    if let Some(pm) = detect_manager_from_package_json(project_root) {\n        return pm;\n    }\n    if project_root.join(\"pnpm-lock.yaml\").exists()\n        || project_root.join(\"pnpm-workspace.yaml\").exists()\n    {\n        return DepsManager::Pnpm;\n    }\n    if project_root.join(\"bun.lockb\").exists() || project_root.join(\"bun.lock\").exists() {\n        return DepsManager::Bun;\n    }","sourceCodeStart":86,"sourceCodeEnd":122,"githubUrl":"https://github.com/nikivdev/code/blob/a747e741ae92c09071d0ae946ab48488adcff1ce/src/deps.rs#L86-L122","documentation":"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.","triggerScenarios":"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.","commonSituations":"Hitting this after a CLI refactor where subcommands route actions to the wrong builder; calling library internals directly with an unsupported action.","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"],"exampleFix":"// before\nmatch action {\n    DepsAction::Update(_) => build_command(action, ctx)?, // wrong builder\n    _ => build_command(action, ctx)?,\n}\n\n// after\nmatch action {\n    DepsAction::Update(_) => build_commands(target, opts)?,\n    _ => build_command(action, ctx)?,\n}","handlingStrategy":"type-guard","validationCode":"// route actions correctly before calling\nmatch action {\n    DepsAction::Install { .. } => build_command(action, ctx)?,\n    _ => return Err(anyhow!(\"use the planner path for non-install actions\")),\n}","typeGuard":"fn is_install_action(a: &DepsAction) -> bool {\n    matches!(a, DepsAction::Install { .. })\n}","tryCatchPattern":null,"preventionTips":["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"],"tags":["internal","dependencies","invariant-violation"],"backgroundTag":"unsupported-action-variant","analyzedSha":"a747e741ae92c09071d0ae946ab48488adcff1ce","analyzedAt":"2026-09-01T22:43:55.719Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}