{"record":{"id":"c6dcd6f226f82d15","repo":"nanocoai/nanoclaw","slug":"from-is-required","errorCode":null,"errorMessage":"--from is required","messagePattern":"--from is required","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/cli/resources/policies.ts","lineNumber":32,"sourceCode":"    { name: 'to_agent_group_id', type: 'string', description: 'Target agent group. References agent_groups.id.' },\n    {\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');","sourceCodeStart":14,"sourceCodeEnd":50,"githubUrl":"https://github.com/nanocoai/nanoclaw/blob/294ef2aee85218b23ad30eda9dfe10e590b54a8c/src/cli/resources/policies.ts#L14-L50","documentation":"Thrown by `ncl policies set` when the --from flag is missing. The policy gates agent-to-agent messages, so the source agent group id is required to key the message_policies row.","triggerScenarios":"Running `ncl policies set --to <gid> --approver <uid>` without --from; wrong flag alias in a script.","commonSituations":"Operator forgets the policy is directional (from → to) and supplies only one side; empty shell variable in automation.","solutions":["Pass --from with a valid agent group id: `ncl policies set --from <src> --to <dst> --approver <uid>`","Get ids from `ncl groups list`"],"exampleFix":"// before\nncl policies set --to grp-b --approver telegram:owner\n// after\nncl policies set --from grp-a --to grp-b --approver telegram:owner","handlingStrategy":"validation","validationCode":"if (!from) throw new Error('--from required');","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Policies are directional — always pass both endpoints","Validate both ids via `ncl groups list --json` first"],"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"}