nanocoai/nanoclaw · error · Error

--name is required

Error message

--name is required

What it means

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.

Source

Thrown at src/cli/resources/groups.ts:433

        }

        await updateContainerConfigScalars(id, updates);

        const updated = (await getContainerConfig(id))!;
        return presentConfig(updated);
      },
    },
    'config add-mcp-server': {
      access: 'approval',
      description:
        'Add an MCP server to a group. Requires `ncl groups restart` to take effect. ' +
        'Use --id <group-id> --name <server-name> with either --command <cmd> [--args <json-array>] [--env <json-object>] ' +
        'or --url <url> [--headers <json-object>] (HTTPS, or plain HTTP for localhost / host.docker.internal).',
      handler: async (args) => {
        const id = args.id as string;
        if (!id) throw new Error('--id is required');
        const name = args.name as string;
        if (!name) throw new Error('--name is required');
        validateMcpServerName(name);

        const row = await getContainerConfig(id);
        if (!row) throw new Error(`No container config for group: ${id}`);

        const servers = JSON.parse(row.mcp_servers) as Record<string, McpServerConfig>;
        const owner = mcpServerPluginOwner(servers[name]);
        if (owner) {
          throw new Error(
            `MCP server "${name}" is owned by plugin "${owner}" — ` +
              'update the plugin and restamp it (`ncl groups create --template <ref> --yes`) instead of editing it directly',
          );
        }
        servers[name] = parseMcpServerConfig({
          command: args.command,
          url: args.url,
          args: args.args === undefined ? undefined : JSON.parse(String(args.args)),
          env: args.env === undefined ? undefined : JSON.parse(String(args.env)),

View on GitHub (pinned to 294ef2aee8)

Solutions

  1. Add `--name <server-name>`
  2. Keep the name short and identifier-like — it's validated by validateMcpServerName
  3. Check spelling against the command description

Example fix

# before
ncl groups config add-mcp-server --id g --command npx --args '["-y","mcp-server"]'
# after
ncl groups config add-mcp-server --id g --name tools --command npx --args '["-y","mcp-server"]'
Defensive patterns

Strategy: validation

Validate before calling

if (!serverName || !/^[a-zA-Z0-9_-]+$/.test(serverName)) throw new Error('add-mcp-server: valid --name required');

Type guard

const isValidServerName = (v: unknown): v is string => typeof v === 'string' && /^[a-zA-Z0-9_-]+$/.test(v);

Prevention

When it happens

Trigger: Running add-mcp-server with only `--id` and a `--command`/`--url` but no `--name`; a typo like `--server-name`.

Common situations: Assuming the name is derived from the command binary; copy-paste from docs that shorten examples; flag typo.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


AI-assisted analysis of nanocoai/nanoclaw@294ef2aee8 (2026-08-28). Data as JSON: /api/errors/a921b0849486b975. Report an issue: GitHub.