{"record":{"id":"e5c2bb7d28a3b310","repo":"nanocoai/nanoclaw","slug":"group-is-required","errorCode":null,"errorMessage":"--group is required","messagePattern":"--group is required","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/cli/resources/members.ts","lineNumber":40,"sourceCode":"    },\n    {\n      name: 'added_by',\n      type: 'string',\n      description: 'User ID of whoever added this member. Informational — not enforced.',\n    },\n    { name: 'added_at', type: 'string', description: 'ISO 8601 timestamp of when the membership was granted.' },\n  ],\n  operations: { list: 'open' },\n  customOperations: {\n    add: {\n      access: 'approval',\n      description: 'Add a user as a member of an agent group. Use --user and --group.',\n      handler: async (args) => {\n        const userId = args.user as string;\n        const groupId = args.group as string;\n        const addedBy = (args.added_by as string) ?? null;\n        if (!userId) throw new Error('--user is required');\n        if (!groupId) throw new Error('--group is required');\n        await getDb().run(\n          `INSERT INTO agent_group_members (user_id, agent_group_id, added_by, added_at)\n             VALUES (?, ?, ?, ?)\n             ON CONFLICT (user_id, agent_group_id) DO NOTHING`,\n          userId,\n          groupId,\n          addedBy,\n          new Date().toISOString(),\n        );\n        return { user_id: userId, agent_group_id: groupId };\n      },\n    },\n    remove: {\n      access: 'approval',\n      description: 'Remove a user from an agent group. Use --user and --group.',\n      handler: async (args) => {\n        const userId = args.user as string;\n        const groupId = args.group as string;","sourceCodeStart":22,"sourceCodeEnd":58,"githubUrl":"https://github.com/nanocoai/nanoclaw/blob/294ef2aee85218b23ad30eda9dfe10e590b54a8c/src/cli/resources/members.ts#L22-L58","documentation":"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.","triggerScenarios":"Running `ncl members add --user <uid>` with no --group; using --agent-group or another alias the handler does not read.","commonSituations":"Operator assumes the group is implied by context or an env var; misspells the flag in automation scripts.","solutions":["Pass --group: `ncl members add --user <uid> --group <gid>`","Get valid ids from `ncl groups list`"],"exampleFix":"// before\nncl members add --user telegram:alice\n// after\nncl members add --user telegram:alice --group grp1","handlingStrategy":"validation","validationCode":"if (!groupId) throw new Error('--group required');","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Fetch group ids dynamically rather than hardcoding","Use `ncl groups list --json` in scripts to validate ids first"],"tags":["cli","missing-argument","members"],"backgroundTag":"missing-cli-flag","analyzedSha":"294ef2aee85218b23ad30eda9dfe10e590b54a8c","analyzedAt":"2026-08-28T13:59:10.357Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}