{"record":{"id":"52107062ce26378f","repo":"nanocoai/nanoclaw","slug":"approver-is-required","errorCode":null,"errorMessage":"--approver is required","messagePattern":"--approver is required","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/cli/resources/policies.ts","lineNumber":34,"sourceCode":"      name: 'approver',\n      type: 'string',\n      description: 'User-id who approves each gated message (required). Only this user (or an owner) can approve.',\n    },\n    { name: 'created_at', type: 'string', description: 'Auto-set.' },\n  ],\n  operations: { list: 'open' },\n  customOperations: {\n    set: {\n      access: 'approval',\n      description:\n        'Require approval for messages from one agent to another. Use --from <agent-group-id> --to <agent-group-id> --approver <user-id>. Only the named approver (or an owner) can approve.',\n      handler: async (args) => {\n        const from = args.from as string;\n        const to = args.to as string;\n        const approver = args.approver as string;\n        if (!from) throw new Error('--from is required');\n        if (!to) throw new Error('--to is required');\n        if (!approver) throw new Error('--approver is required');\n        if (from === to) throw new Error('--from and --to must differ (self-messages are never gated)');\n        if (!(await getAgentGroup(from))) throw new Error(`source agent group not found: ${from}`);\n        if (!(await getAgentGroup(to))) throw new Error(`target agent group not found: ${to}`);\n\n        await setMessagePolicy(from, to, approver, new Date().toISOString());\n        return { from_agent_group_id: from, to_agent_group_id: to, approver };\n      },\n    },\n    remove: {\n      access: 'approval',\n      description: 'Remove an approval policy (back to free flow). Use --from <agent-group-id> --to <agent-group-id>.',\n      handler: async (args) => {\n        const from = args.from as string;\n        const to = args.to as string;\n        if (!from) throw new Error('--from is required');\n        if (!to) throw new Error('--to is required');\n        if (!(await removeMessagePolicy(from, to))) throw new Error('policy not found');\n        return { removed: { from_agent_group_id: from, to_agent_group_id: to } };","sourceCodeStart":16,"sourceCodeEnd":52,"githubUrl":"https://github.com/nanocoai/nanoclaw/blob/294ef2aee85218b23ad30eda9dfe10e590b54a8c/src/cli/resources/policies.ts#L16-L52","documentation":"Thrown by `ncl policies set` when the --approver flag is missing. Every agent-to-agent approval policy names a specific approver user who (alongside owners) can approve gated messages, so the field is mandatory.","triggerScenarios":"Running `ncl policies set --from <a> --to <b>` without --approver; assuming approval falls back to any admin automatically.","commonSituations":"Operator expects the default approver resolution (pickApprover) to apply here — it does not; the CLI policy path requires an explicit approver id.","solutions":["Pass --approver with a user id: `ncl policies set --from <a> --to <b> --approver telegram:owner`","Confirm the user id exists via `ncl users list`"],"exampleFix":"// before\nncl policies set --from grp-a --to grp-b\n// after\nncl policies set --from grp-a --to grp-b --approver telegram:owner","handlingStrategy":"validation","validationCode":"if (!approver || !approver.includes(':')) throw new Error('--approver must be a user id <channel>:<handle>');","typeGuard":"const isUserId = (s) => /^[a-z0-9-]+:[A-Za-z0-9_.-]+$/.test(s);","tryCatchPattern":null,"preventionTips":["Remember CLI policies need an explicit approver; no fallback resolution here","Keep a canonical owner user id in your runbook"],"tags":["cli","missing-argument","policies","approvals"],"backgroundTag":"missing-cli-flag","analyzedSha":"294ef2aee85218b23ad30eda9dfe10e590b54a8c","analyzedAt":"2026-08-28T13:59:10.357Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}