nanocoai/nanoclaw · error · Error

--group is required

Error message

--group is required

What it means

Thrown by `ncl members add` when the --group flag is missing. Membership is always scoped to a specific agent group, so the target group id is mandatory for the insert into agent_group_members.

Source

Thrown at src/cli/resources/members.ts:40

    },
    {
      name: 'added_by',
      type: 'string',
      description: 'User ID of whoever added this member. Informational — not enforced.',
    },
    { name: 'added_at', type: 'string', description: 'ISO 8601 timestamp of when the membership was granted.' },
  ],
  operations: { list: 'open' },
  customOperations: {
    add: {
      access: 'approval',
      description: 'Add a user as a member of an agent group. Use --user and --group.',
      handler: async (args) => {
        const userId = args.user as string;
        const groupId = args.group as string;
        const addedBy = (args.added_by as string) ?? null;
        if (!userId) throw new Error('--user is required');
        if (!groupId) throw new Error('--group is required');
        await getDb().run(
          `INSERT INTO agent_group_members (user_id, agent_group_id, added_by, added_at)
             VALUES (?, ?, ?, ?)
             ON CONFLICT (user_id, agent_group_id) DO NOTHING`,
          userId,
          groupId,
          addedBy,
          new Date().toISOString(),
        );
        return { user_id: userId, agent_group_id: groupId };
      },
    },
    remove: {
      access: 'approval',
      description: 'Remove a user from an agent group. Use --user and --group.',
      handler: async (args) => {
        const userId = args.user as string;
        const groupId = args.group as string;

View on GitHub (pinned to 294ef2aee8)

Solutions

  1. Pass --group: `ncl members add --user <uid> --group <gid>`
  2. Get valid ids from `ncl groups list`

Example fix

// before
ncl members add --user telegram:alice
// after
ncl members add --user telegram:alice --group grp1
Defensive patterns

Strategy: validation

Validate before calling

if (!groupId) throw new Error('--group required');

Prevention

When it happens

Trigger: Running `ncl members add --user <uid>` with no --group; using --agent-group or another alias the handler does not read.

Common situations: Operator assumes the group is implied by context or an env var; misspells the flag in automation scripts.

Related errors


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