ruvnet/ruflo · error · Error

unknown policy operation: ${operation}

Error message

unknown policy operation: ${operation}

What it means

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.

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 6b01dc5a68)

Solutions

  1. Run `ruflo policy` with no args (defaults to status) or `ruflo policy --help` to enumerate operations.
  2. Use one of: init, migrate, status, rule, budget, approve (throws by design), revoke, audit, verify.
  3. If the operation genuinely should exist, file an issue — but first confirm against the examples block in policy.ts.

Example fix

// before
ruflo policy rules
// after
ruflo policy rule add '{"id":"r1","action":"model.call","effect":"allow"}'
Defensive patterns

Strategy: validation

Validate before calling

const POLICY_OPS = new Set(['init','migrate','status','rule','budget','approve','revoke','audit','verify']);
function assertKnownPolicyOp(op: string): void {
  if (!POLICY_OPS.has(op)) {
    throw new Error(`unknown policy operation: ${op}. Known: ${[...POLICY_OPS].join(', ')}`);
  }
}

Type guard

const isKnownPolicyOp = (op: unknown): op is string =>
  typeof op === 'string' &&
  ['init','migrate','status','rule','budget','approve','revoke','audit','verify'].includes(op);

Try / catch

try {
  await runPolicy(op);
} catch (e) {
  const msg = e instanceof Error ? e.message : String(e);
  if (msg.startsWith('unknown policy operation')) {
    console.error('Run `ruflo policy --help` for the operation list.');
    process.exit(2);
  }
  throw e;
}

Prevention

When it happens

Trigger: Typing `ruflo policy <typo>` such as `polciy`, `rules` (plural, unsupported), `get`, `delete`, or any verb not in the recognized set.

Common situations: Typos, pluralizing a singular verb, guessing an operation name, or using vocabulary from a different version of the CLI.

Related errors


AI-assisted analysis of ruvnet/ruflo@6b01dc5a68 (2026-08-12). Data as JSON: /api/errors/4090e7e7fd2a078c. Report an issue: GitHub.