{"record":{"id":"0f314aa2a9020382","repo":"nanocoai/nanoclaw","slug":"user-is-required","errorCode":null,"errorMessage":"--user is required","messagePattern":"--user is required","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/cli/resources/members.ts","lineNumber":39,"sourceCode":"      description: 'The agent group to grant access to. Must reference an existing agent group (agent_groups.id).',\n    },\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;","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/nanocoai/nanoclaw/blob/294ef2aee85218b23ad30eda9dfe10e590b54a8c/src/cli/resources/members.ts#L21-L57","documentation":"Thrown by `ncl members add` when the --user flag is missing. The handler inserts into agent_group_members, which requires a user_id in the form <channel>:<handle> (e.g. telegram:alice).","triggerScenarios":"Running `ncl members add --group <gid>` without --user, or passing the user id via the wrong flag name.","commonSituations":"Operator forgets the user id must be the fully-qualified channel-prefixed id and skips it, or scripts the call with an empty variable ($USER empty).","solutions":["Pass --user with the channel-qualified id: `ncl members add --user telegram:alice --group <gid>`","Find the exact id via `ncl users list` if unsure of the format"],"exampleFix":"// before\nncl members add --group grp1\n// after\nncl members add --user telegram:alice --group grp1","handlingStrategy":"validation","validationCode":"if (!userId?.includes(':')) throw new Error('expected --user <channel>:<handle>');","typeGuard":"const isQualifiedUserId = (s) => /^[a-z0-9-]+:[A-Za-z0-9_.-]+$/.test(s);","tryCatchPattern":null,"preventionTips":["Always use channel-qualified user ids","Quote variables and use shellcheck on scripts"],"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"}