nanocoai/nanoclaw · error · Error
--user is required
Error message
--user is required
What it means
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).
Source
Thrown at src/cli/resources/members.ts:39
description: 'The agent group to grant access to. Must reference an existing agent group (agent_groups.id).',
},
{
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;View on GitHub (pinned to 294ef2aee8)
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
Example fix
// before ncl members add --group grp1 // after ncl members add --user telegram:alice --group grp1
Defensive patterns
Strategy: validation
Validate before calling
if (!userId?.includes(':')) throw new Error('expected --user <channel>:<handle>'); Type guard
const isQualifiedUserId = (s) => /^[a-z0-9-]+:[A-Za-z0-9_.-]+$/.test(s);
Prevention
- Always use channel-qualified user ids
- Quote variables and use shellcheck on scripts
When it happens
Trigger: Running `ncl members add --group <gid>` without --user, or passing the user id via the wrong flag name.
Common situations: 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).
Related errors
- --group is required
- ${def.name} id is required
- --${col.name.replace(/_/g, '-')} is required
- --folder is required
- --id is required
AI-assisted analysis of nanocoai/nanoclaw@294ef2aee8 (2026-08-28).
Data as JSON: /api/errors/0f314aa2a9020382.
Report an issue: GitHub.