{"record":{"id":"4090e7e7fd2a078c","repo":"ruvnet/ruflo","slug":"unknown-policy-operation-operation","errorCode":null,"errorMessage":"unknown policy operation: ${operation}","messagePattern":"unknown policy operation: (.+?)","errorType":"exception","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/6b01dc5a687b26b3e218f796de45ec51f8fa9e8c/v3/@claude-flow/cli/src/commands/policy.ts#L86-L120","documentation":"Thrown after every recognized operation branch (init/migrate, status, rule, budget, approve, revoke, audit, verify) has failed to match. The operation token (args[0]) is not a known policy verb, so the command refuses to silently no-op or guess.","triggerScenarios":"Typing `ruflo policy <typo>` such as `polciy`, `rules` (plural, unsupported), `get`, `delete`, or any verb not in the recognized set.","commonSituations":"Typos, pluralizing a singular verb, guessing an operation name, or using vocabulary from a different version of the CLI.","solutions":["Run `ruflo policy` with no args (defaults to status) or `ruflo policy --help` to enumerate operations.","Use one of: init, migrate, status, rule, budget, approve (throws by design), revoke, audit, verify.","If the operation genuinely should exist, file an issue — but first confirm against the examples block in policy.ts."],"exampleFix":"// before\nruflo policy rules\n// after\nruflo policy rule add '{\"id\":\"r1\",\"action\":\"model.call\",\"effect\":\"allow\"}'","handlingStrategy":"validation","validationCode":"const POLICY_OPS = new Set(['init','migrate','status','rule','budget','approve','revoke','audit','verify']);\nfunction assertKnownPolicyOp(op: string): void {\n  if (!POLICY_OPS.has(op)) {\n    throw new Error(`unknown policy operation: ${op}. Known: ${[...POLICY_OPS].join(', ')}`);\n  }\n}","typeGuard":"const isKnownPolicyOp = (op: unknown): op is string =>\n  typeof op === 'string' &&\n  ['init','migrate','status','rule','budget','approve','revoke','audit','verify'].includes(op);","tryCatchPattern":"try {\n  await runPolicy(op);\n} catch (e) {\n  const msg = e instanceof Error ? e.message : String(e);\n  if (msg.startsWith('unknown policy operation')) {\n    console.error('Run `ruflo policy --help` for the operation list.');\n    process.exit(2);\n  }\n  throw e;\n}","preventionTips":["Enumerate operations with `ruflo policy --help`.","Drive op names from a constant set in your scripts.","Avoid pluralizing or abbreviating operation names."],"tags":["cli","validation","policy"],"backgroundTag":null,"analyzedSha":"6b01dc5a687b26b3e218f796de45ec51f8fa9e8c","analyzedAt":"2026-08-12T13:20:50.148Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}