{"record":{"id":"a921b0849486b975","repo":"nanocoai/nanoclaw","slug":"name-is-required","errorCode":null,"errorMessage":"--name is required","messagePattern":"--name is required","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/cli/resources/groups.ts","lineNumber":433,"sourceCode":"        }\n\n        await updateContainerConfigScalars(id, updates);\n\n        const updated = (await getContainerConfig(id))!;\n        return presentConfig(updated);\n      },\n    },\n    'config add-mcp-server': {\n      access: 'approval',\n      description:\n        'Add an MCP server to a group. Requires `ncl groups restart` to take effect. ' +\n        'Use --id <group-id> --name <server-name> with either --command <cmd> [--args <json-array>] [--env <json-object>] ' +\n        'or --url <url> [--headers <json-object>] (HTTPS, or plain HTTP for localhost / host.docker.internal).',\n      handler: async (args) => {\n        const id = args.id as string;\n        if (!id) throw new Error('--id is required');\n        const name = args.name as string;\n        if (!name) throw new Error('--name is required');\n        validateMcpServerName(name);\n\n        const row = await getContainerConfig(id);\n        if (!row) throw new Error(`No container config for group: ${id}`);\n\n        const servers = JSON.parse(row.mcp_servers) as Record<string, McpServerConfig>;\n        const owner = mcpServerPluginOwner(servers[name]);\n        if (owner) {\n          throw new Error(\n            `MCP server \"${name}\" is owned by plugin \"${owner}\" — ` +\n              'update the plugin and restamp it (`ncl groups create --template <ref> --yes`) instead of editing it directly',\n          );\n        }\n        servers[name] = parseMcpServerConfig({\n          command: args.command,\n          url: args.url,\n          args: args.args === undefined ? undefined : JSON.parse(String(args.args)),\n          env: args.env === undefined ? undefined : JSON.parse(String(args.env)),","sourceCodeStart":415,"sourceCodeEnd":451,"githubUrl":"https://github.com/nanocoai/nanoclaw/blob/294ef2aee85218b23ad30eda9dfe10e590b54a8c/src/cli/resources/groups.ts#L415-L451","documentation":"The `config add-mcp-server` handler requires a server name (`--name`) to use as the key in the group's mcp_servers JSON map; it was absent.","triggerScenarios":"Running add-mcp-server with only `--id` and a `--command`/`--url` but no `--name`; a typo like `--server-name`.","commonSituations":"Assuming the name is derived from the command binary; copy-paste from docs that shorten examples; flag typo.","solutions":["Add `--name <server-name>`","Keep the name short and identifier-like — it's validated by validateMcpServerName","Check spelling against the command description"],"exampleFix":"# before\nncl groups config add-mcp-server --id g --command npx --args '[\"-y\",\"mcp-server\"]'\n# after\nncl groups config add-mcp-server --id g --name tools --command npx --args '[\"-y\",\"mcp-server\"]'","handlingStrategy":"validation","validationCode":"if (!serverName || !/^[a-zA-Z0-9_-]+$/.test(serverName)) throw new Error('add-mcp-server: valid --name required');","typeGuard":"const isValidServerName = (v: unknown): v is string => typeof v === 'string' && /^[a-zA-Z0-9_-]+$/.test(v);","tryCatchPattern":null,"preventionTips":["Pass --name from a constant shared between add and remove code","Validate the name shape before invoking the CLI"],"tags":["cli","validation","mcp"],"backgroundTag":"missing-required-argument","analyzedSha":"294ef2aee85218b23ad30eda9dfe10e590b54a8c","analyzedAt":"2026-08-28T13:59:10.357Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}