ruvnet/ruflo · error

unsupported-policy-state-version:${String(parsed.version)}

Error message

unsupported-policy-state-version:${String(parsed.version)}

What it means

loadPolicyState() read a persisted policy state file whose version number is not one this runtime knows how to interpret. The unsupported version is embedded in the message; the state stays unread rather than being misparsed by an incompatible schema.

Source

Thrown at v3/@claude-flow/cli/src/services/policy-runtime.ts:174

    const file = join(resolve(projectRoot), relative);
    if (!existsSync(file)) continue;
    const content = readFileSync(file, 'utf8');
    const section = content.match(/(?:^|\n)\[policy\]\s*\n([\s\S]*?)(?=\n\[[^\]]+\]|\s*$)/)?.[1];
    const mode = section?.match(/(?:^|\n)\s*mode\s*=\s*"(legacy|observe|enforce)"/)?.[1];
    if (mode) configured = mode as PolicyState['mode'];
  }
  return configured;
}

export function loadPolicyState(projectRoot = process.cwd()): PolicyState {
  const target = paths(projectRoot);
  if (!existsSync(target.state)) {
    verifyStateAnchor(projectRoot, undefined);
    return createLegacyCompatibleState(detectLegacyCapabilities(projectRoot));
  }
  const parsed = JSON.parse(readFileSync(target.state, 'utf8')) as PolicyState;
  if (parsed.version !== 1 || !Array.isArray(parsed.rules) || !Array.isArray(parsed.receipts)) {
    throw new Error(`unsupported-policy-state-version:${String(parsed.version)}`);
  }
  verifyStateAnchor(projectRoot, parsed);
  return parsed;
}

export async function autoMigratePolicyStateIfNeeded(projectRoot = process.cwd()): Promise<{
  migrated: boolean;
  statePath?: string;
  mode?: PolicyState['mode'];
}> {
  const target = paths(projectRoot);
  if (existsSync(target.state)) {
    const configured = configuredPolicyMode(projectRoot);
    const current = loadPolicyState(projectRoot);
    if (configured && current.configuredMode !== configured) {
      await withPolicyTransaction(projectRoot, (engine) => engine.setConfiguredMode(configured));
    }
    return { migrated: false, statePath: target.state, mode: loadPolicyState(projectRoot).mode };

View on GitHub (pinned to fa13ee4ad6)

Solutions

  1. Migrate the policy state to a supported version
  2. Use a CLI version compatible with the stored policy state version

Example fix

Migrate the policy state to a supported version, or use a CLI version that understands the stored state version.
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at v3/@claude-flow/cli/src/services/policy-runtime.ts:174 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of ruvnet/ruflo@fa13ee4ad6 (2026-08-18). Data as JSON: /api/errors/03261cda2c72ec47. Report an issue: GitHub.