{"record":{"id":"a6f97ae256e5effc","repo":"nanocoai/nanoclaw","slug":"source-agent-group-not-found-from","errorCode":null,"errorMessage":"source agent group not found: ${from}","messagePattern":"source agent group not found: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/cli/resources/policies.ts","lineNumber":36,"sourceCode":"      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 } };\n      },\n    },","sourceCodeStart":18,"sourceCodeEnd":54,"githubUrl":"https://github.com/nanocoai/nanoclaw/blob/294ef2aee85218b23ad30eda9dfe10e590b54a8c/src/cli/resources/policies.ts#L18-L54","documentation":"Thrown by `ncl policies set` when getAgentGroup(from) returns null — the source agent group id passed via --from does not exist in the agent_groups table. The handler validates both endpoints before writing the policy row.","triggerScenarios":"Typo in the --from id; the source group was deleted; the id is a folder name rather than the DB group id.","commonSituations":"Confusing the groups/<folder> directory name with the DB id; stale scripts referencing removed groups.","solutions":["Run `ncl groups list` and copy the exact --from id","If the group was deleted, recreate it or drop the policy intent"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const groups = await listAgentGroups(); if (!groups.some(g => g.id === from)) throw new Error(`unknown source group ${from}`);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use DB group ids, not folder names","Refresh id references after group deletions"],"tags":["cli","not-found","policies","agent-groups"],"backgroundTag":"entity-not-found","analyzedSha":"294ef2aee85218b23ad30eda9dfe10e590b54a8c","analyzedAt":"2026-08-28T13:59:10.357Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}