{"record":{"id":"4090e7e7fd2a078c","repo":"ruvnet/ruflo","slug":"unknown-policy-operation-operation","errorCode":null,"errorMessage":"unknown policy operation: ${operation}","messagePattern":"unknown policy operation: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"v3/@claude-flow/cli/src/commands/policy.ts","lineNumber":104,"sourceCode":"        return print({ success: true, budgetId: budget.id });\n      }\n      if (operation === 'approve') {\n        throw new Error(\n          'approval issuance requires an authenticated human identity adapter; '\n          + 'the local TTY is not an identity credential',\n        );\n      }\n      if (operation === 'revoke') {\n        requireInteractiveAdministrator();\n        if (!args[1]) throw new Error('revoke requires an approval id');\n        return print({ success: await revokePolicyApproval(args[1], root), approvalId: args[1] });\n      }\n      if (operation === 'audit') {\n        const state = loadPolicyState(root);\n        return print({ receipts: state.receipts });\n      }\n      if (operation === 'verify') return print(await verifyPolicyLedger(root));\n      throw new Error(`unknown policy operation: ${operation}`);\n    } catch (error) {\n      const message = error instanceof Error ? error.message : String(error);\n      output.printError(message);\n      return { success: false, exitCode: 1, data: { error: message } };\n    }\n  },\n  examples: [\n    { command: 'ruflo policy status', description: 'Show policy mode and ledger health' },\n    { command: 'ruflo policy init --mode observe', description: 'Migrate an existing install without blocking legacy actions' },\n    { command: 'ruflo policy budget set \\'{\"id\":\"daily-model\",\"action\":\"model.call\",\"maxCostUsd\":10,\"periodMs\":86400000}\\'', description: 'Set an atomic policy budget ceiling' },\n    { command: 'ruflo policy evaluate \\'{\"identity\":{\"id\":\"agent-1\",\"type\":\"agent\"},\"action\":{\"type\":\"deploy\",\"environment\":\"production\"}}\\'', description: 'Evaluate an action and write a decision receipt' },\n  ],\n};\n\nexport default policyCommand;\n","sourceCodeStart":86,"sourceCodeEnd":120,"githubUrl":"https://github.com/ruvnet/ruflo/blob/fa13ee4ad60ac2090b1480656eb233521790d640/v3/@claude-flow/cli/src/commands/policy.ts#L86-L120","documentation":"The policy command dispatches on args[0]; when the operation matches none of status, init, migrate, rule, budget, evaluate, approve, revoke, audit, or verify, it throws naming the offending operation. This is the classic unknown-subcommand error and usually means a typo or a version mismatch between docs and the installed CLI.","triggerScenarios":"Running `ruflo policy rules` (pluralized), `ruflo policy check`, or a subcommand documented in a newer release while running an older installed binary.","commonSituations":"Pluralization mistakes, guessing subcommand names, following README instructions from a different version than the one installed via npx.","solutions":["Run `ruflo policy --help` to list the supported operations for your installed version","Fix spelling: status, init, migrate, rule, budget, evaluate, approve, revoke, audit, verify","If docs reference an operation your binary lacks, upgrade: npx @claude-flow/cli@latest"],"exampleFix":"# before\nruflo policy rules\n\n# after\nruflo policy rule add '{\"id\":\"r1\",\"effect\":\"deny\"}'","handlingStrategy":"validation","validationCode":"const POLICY_OPS = new Set(['status','init','migrate','rule','budget','evaluate','approve','revoke','audit','verify']);\nif (!POLICY_OPS.has(op)) {\n  throw new Error(`unknown policy operation '${op}' — allowed: ${[...POLICY_OPS].join(', ')}`);\n}\nawait runPolicyCli(['policy', op, ...rest]);","typeGuard":"function isPolicyOperation(v: unknown): v is string {\n  return typeof v === 'string' && ['status','init','migrate','rule','budget','evaluate','approve','revoke','audit','verify'].includes(v);\n}","tryCatchPattern":null,"preventionTips":["Pin the CLI version your automation was written against","Derive subcommands from a constant list shared with your scripts","Check `policy --help` after upgrades — new operations may be added and old ones renamed"],"tags":["cli","policy","subcommand","typo"],"backgroundTag":"unknown-subcommand","analyzedSha":"fa13ee4ad60ac2090b1480656eb233521790d640","analyzedAt":"2026-08-18T21:34:22.708Z","contentChangedAt":"2026-08-18T21:34:22.708Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}