{"record":{"id":"3ca3350f3e42ec09","repo":"nanocoai/nanoclaw","slug":"to-is-required","errorCode":null,"errorMessage":"--to is required","messagePattern":"--to is required","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/cli/resources/policies.ts","lineNumber":33,"sourceCode":"    {\n      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');","sourceCodeStart":15,"sourceCodeEnd":51,"githubUrl":"https://github.com/nanocoai/nanoclaw/blob/294ef2aee85218b23ad30eda9dfe10e590b54a8c/src/cli/resources/policies.ts#L15-L51","documentation":"Thrown by `ncl policies set` when the --to flag is missing. The target agent group id is the second half of the (from, to) key for the approval policy.","triggerScenarios":"Running `ncl policies set --from <gid> --approver <uid>` without --to; unset variable in a script.","commonSituations":"Same as other missing-flag errors: copy-paste omissions or empty interpolated variables.","solutions":["Pass --to: `ncl policies set --from <src> --to <dst> --approver <uid>`","Verify the target exists via `ncl groups list`"],"exampleFix":"// before\nncl policies set --from grp-a --approver telegram:owner\n// after\nncl policies set --from grp-a --to grp-b --approver telegram:owner","handlingStrategy":"validation","validationCode":"if (!to) throw new Error('--to required');","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pass from/to as an explicit pair in scripts","Fail fast on empty variables with set -u"],"tags":["cli","missing-argument","policies"],"backgroundTag":"missing-cli-flag","analyzedSha":"294ef2aee85218b23ad30eda9dfe10e590b54a8c","analyzedAt":"2026-08-28T13:59:10.357Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}