{"record":{"id":"d585c6a8e3b85db5","repo":"nanocoai/nanoclaw","slug":"provide-apt-pkg-or-npm-pkg","errorCode":null,"errorMessage":"Provide --apt <pkg> or --npm <pkg>","messagePattern":"Provide --apt <pkg> or --npm <pkg>","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/cli/resources/groups.ts","lineNumber":500,"sourceCode":"        await updateContainerConfigJson(id, 'mcp_servers', servers);\n\n        return { removed: name };\n      },\n    },\n    'config add-package': {\n      access: 'approval',\n      description:\n        'Add a package to a group. Requires `ncl groups restart --rebuild` to take effect. Use --id <group-id> and --apt <pkg> or --npm <pkg>.',\n      handler: async (args) => {\n        const id = args.id as string;\n        if (!id) throw new Error('--id is required');\n\n        const row = await getContainerConfig(id);\n        if (!row) throw new Error(`No container config for group: ${id}`);\n\n        const apt = args.apt as string | undefined;\n        const npm = args.npm as string | undefined;\n        if (!apt && !npm) throw new Error('Provide --apt <pkg> or --npm <pkg>');\n\n        if (apt) {\n          const existing = JSON.parse(row.packages_apt) as string[];\n          if (!existing.includes(apt)) {\n            existing.push(apt);\n            await updateContainerConfigJson(id, 'packages_apt', existing);\n          }\n        }\n        if (npm) {\n          const existing = JSON.parse(row.packages_npm) as string[];\n          if (!existing.includes(npm)) {\n            existing.push(npm);\n            await updateContainerConfigJson(id, 'packages_npm', existing);\n          }\n        }\n\n        return {\n          added: { apt: apt || null, npm: npm || null },","sourceCodeStart":482,"sourceCodeEnd":518,"githubUrl":"https://github.com/nanocoai/nanoclaw/blob/294ef2aee85218b23ad30eda9dfe10e590b54a8c/src/cli/resources/groups.ts#L482-L518","documentation":"Thrown by `ncl groups config add-package` when neither `--apt` nor `--npm` is provided. The handler requires exactly one package spec per invocation because apt and npm package lists are stored in separate JSON columns (`packages_apt`, `packages_npm`).","triggerScenarios":"`ncl groups config add-package --id <group-id>` with no package flag, or with an empty value like `--apt \"\"`.","commonSituations":"Operator assumes the command is interactive; script passes a variable that expanded to nothing; user thinks the package name is positional.","solutions":["Add the flag: `--apt <pkg>` for system packages or `--npm <pkg>` for node packages","Run one package per invocation — the handler reads, pushes, and rewrites the whole JSON array each time"],"exampleFix":"# before\nncl groups config add-package --id my-group\n# after\nncl groups config add-package --id my-group --apt ripgrep","handlingStrategy":"validation","validationCode":"if (!apt && !npm) { console.error('pass --apt <pkg> or --npm <pkg>'); process.exit(1); }","typeGuard":"const hasPkgFlag = (a: { apt?: string; npm?: string }) => Boolean(a.apt || a.npm);","tryCatchPattern":null,"preventionTips":["One package per invocation; pass exactly one of --apt/--npm","Lint wrapper scripts to reject ncl invocations of add-package lacking both flags"],"tags":["cli","missing-argument","ncl","packages"],"backgroundTag":"missing-required-argument","analyzedSha":"294ef2aee85218b23ad30eda9dfe10e590b54a8c","analyzedAt":"2026-08-28T13:59:10.357Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}