ruvnet/ruflo · error · Error
unknown policy operation
Error message
unknown policy operation: ${operation} What it means
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.
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
Example fix
# before
ruflo policy rules
# after
ruflo policy rule add '{"id":"r1","effect":"deny"}' Defensive patterns
Strategy: validation
Validate before calling
const POLICY_OPS = new Set(['status','init','migrate','rule','budget','evaluate','approve','revoke','audit','verify']);
if (!POLICY_OPS.has(op)) {
throw new Error(`unknown policy operation '${op}' — allowed: ${[...POLICY_OPS].join(', ')}`);
}
await runPolicyCli(['policy', op, ...rest]); Type guard
function isPolicyOperation(v: unknown): v is string {
return typeof v === 'string' && ['status','init','migrate','rule','budget','evaluate','approve','revoke','audit','verify'].includes(v);
} Prevention
- 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
When it happens
Trigger: Running `ruflo policy rules` (pluralized), `ruflo policy check`, or a subcommand documented in a newer release while running an older installed binary.
Common situations: Pluralization mistakes, guessing subcommand names, following README instructions from a different version than the one installed via npx.
Related errors
- approval issuance requires an authenticated human identity…
- must be valid JSON
- requires a JSON argument
- mode must be legacy, observe, or enforce
- policy administration requires an interactive local terminal
AI-assisted analysis of ruvnet/ruflo@fa13ee4ad6 (2026-08-18).
Data as JSON: /api/errors/4090e7e7fd2a078c.
Report an issue: GitHub.
Appendix: source
Thrown at v3/@claude-flow/cli/src/commands/policy.ts:104
return print({ success: true, budgetId: budget.id });
}
if (operation === 'approve') {
throw new Error(
'approval issuance requires an authenticated human identity adapter; '
+ 'the local TTY is not an identity credential',
);
}
if (operation === 'revoke') {
requireInteractiveAdministrator();
if (!args[1]) throw new Error('revoke requires an approval id');
return print({ success: await revokePolicyApproval(args[1], root), approvalId: args[1] });
}
if (operation === 'audit') {
const state = loadPolicyState(root);
return print({ receipts: state.receipts });
}
if (operation === 'verify') return print(await verifyPolicyLedger(root));
throw new Error(`unknown policy operation: ${operation}`);
} catch (error) {
const message = error instanceof Error ? error.message : String(error);
output.printError(message);
return { success: false, exitCode: 1, data: { error: message } };
}
},
examples: [
{ command: 'ruflo policy status', description: 'Show policy mode and ledger health' },
{ command: 'ruflo policy init --mode observe', description: 'Migrate an existing install without blocking legacy actions' },
{ command: 'ruflo policy budget set \'{"id":"daily-model","action":"model.call","maxCostUsd":10,"periodMs":86400000}\'', description: 'Set an atomic policy budget ceiling' },
{ command: 'ruflo policy evaluate \'{"identity":{"id":"agent-1","type":"agent"},"action":{"type":"deploy","environment":"production"}}\'', description: 'Evaluate an action and write a decision receipt' },
],
};
export default policyCommand;
View on GitHub (pinned to fa13ee4ad6)