{"record":{"id":"ad68b800be596117","repo":"ruvnet/ruflo","slug":"revoke-requires-an-approval-id","errorCode":null,"errorMessage":"revoke requires an approval id","messagePattern":"revoke requires an approval id","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"v3/@claude-flow/cli/src/commands/policy.ts","lineNumber":96,"sourceCode":"        const rule = argJson<PolicyRule>(args[2], 'rule add');\n        await upsertPolicyRule(rule, root);\n        return print({ success: true, ruleId: rule.id });\n      }\n      if (operation === 'budget' && args[1] === 'set') {\n        requireInteractiveAdministrator();\n        const budget = argJson<BudgetLimit>(args[2], 'budget set');\n        await setPolicyBudget(budget, root);\n        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' },","sourceCodeStart":78,"sourceCodeEnd":114,"githubUrl":"https://github.com/ruvnet/ruflo/blob/fa13ee4ad60ac2090b1480656eb233521790d640/v3/@claude-flow/cli/src/commands/policy.ts#L78-L114","documentation":"The `policy revoke` subcommand requires the approval id as its first positional argument; when args[1] is missing or empty, this error is thrown before revokePolicyApproval runs. The id identifies which approval entry to remove from the policy state.","triggerScenarios":"Running `ruflo policy revoke` with no argument, or passing an empty string '' (also falsy), or an invocation where a preceding flag consumed the value.","commonSituations":"Assuming revoke will prompt for the id; passing the id after another argument that shifts positions; quoting mistakes yielding an empty argv entry.","solutions":["List approvals first with `ruflo policy audit` and copy the exact approval id","Pass it positionally: ruflo policy revoke <approvalId>","Quote ids that contain special characters so the shell delivers them intact"],"exampleFix":"# before\nruflo policy revoke\n\n# after\nruflo policy revoke appr_20260818_001","handlingStrategy":"validation","validationCode":"if (!approvalId || approvalId.trim() === '') {\n  const audit = await runPolicyCli(['policy', 'audit']); // read receipts to find the id\n  throw new Error('approval id required — pick one from `policy audit`');\n}\nawait runPolicyCli(['policy', 'revoke', approvalId]);","typeGuard":"function hasApprovalId(v: string | undefined): v is string {\n  return typeof v === 'string' && v.trim().length > 0;\n}","tryCatchPattern":null,"preventionTips":["Always fetch the id from `policy audit` output rather than typing from memory","Trim and assert non-empty ids in wrappers before invoking the CLI","Remember position: `policy revoke <id>` — the id is args[1], after the operation"],"tags":["cli","policy","arguments","approvals"],"backgroundTag":"missing-required-argument","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"}