{"record":{"id":"93bc5c984f2407f7","repo":"nanocoai/nanoclaw","slug":"mcp-server-name-not-found","errorCode":null,"errorMessage":"MCP server \"${name}\" not found","messagePattern":"MCP server \"(.+?)\" not found","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/cli/resources/groups.ts","lineNumber":473,"sourceCode":"\n        return { added: name, servers };\n      },\n    },\n    'config remove-mcp-server': {\n      access: 'approval',\n      description:\n        'Remove an MCP server from a group. Requires `ncl groups restart` to take effect. Use --id <group-id> --name <server-name>.',\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\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        if (!servers[name]) throw new Error(`MCP server \"${name}\" not found`);\n        const owner = mcpServerPluginOwner(servers[name]);\n        if (owner) {\n          throw new Error(\n            `MCP server \"${name}\" is owned by plugin \"${owner}\" — ` +\n              'it would reappear on the next restamp; remove it from the plugin instead',\n          );\n        }\n        delete servers[name];\n        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) => {","sourceCodeStart":455,"sourceCodeEnd":491,"githubUrl":"https://github.com/nanocoai/nanoclaw/blob/294ef2aee85218b23ad30eda9dfe10e590b54a8c/src/cli/resources/groups.ts#L455-L491","documentation":"The key `name` does not exist in the group's mcp_servers JSON map, so there is nothing to remove. Checked before plugin-ownership and deletion.","triggerScenarios":"Removing a server under a different name than it was added with (e.g. added as `--name tools`, removed as `--name tool`); server already removed; name from a different group's config.","commonSituations":"Name drift between add and remove commands; double-running a removal script; checking the wrong group's config.","solutions":["Run `ncl groups config get --id <g>` and copy the exact server key","Make removal scripts idempotent (check existence first or tolerate this error)","Confirm you're targeting the right group id"],"exampleFix":"# before\nncl groups config remove-mcp-server --id g --name tool\n# after\nncl groups config get --id g        # shows key \"tools\"\nncl groups config remove-mcp-server --id g --name tools","handlingStrategy":"validation","validationCode":"const cfg = await ncl(`groups config get --id ${groupId} --json`);\nif (!Object.keys(cfg.mcpServers ?? {}).includes(serverName)) {\n  console.log(`${serverName} already absent — nothing to do`);\n  process.exit(0);\n}","typeGuard":"const existsIn = (name: string, map: Record<string, unknown> | undefined) => Boolean(map && name in map);","tryCatchPattern":"catch (e) { if (/MCP server \".*\" not found/.test(String(e))) { /* treat as already-removed success */ } else throw e; }","preventionTips":["Make remove scripts idempotent by checking existence first","Use exact keys from `groups config get` JSON output"],"tags":["mcp","cli","not-found"],"backgroundTag":"record-not-found","analyzedSha":"294ef2aee85218b23ad30eda9dfe10e590b54a8c","analyzedAt":"2026-08-28T13:59:10.357Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}