ruvnet/ruflo · error · Error

out-of-range CIDR: ${cidr}

Error message

out-of-range CIDR: ${cidr}

What it means

parseCidr matched the CIDR shape but a numeric component is out of range: an octet greater than 255 or a prefix length greater than 32. The textual format was valid, but the value cannot denote a real IPv4 network, so mesh-subnet derivation cannot proceed.

Source

Thrown at v3/@claude-flow/plugin-agent-federation/src/domain/value-objects/wg-config.ts:89

  return {
    publicKey: pubRaw.toString('base64'),
    privateKey: privRaw.toString('base64'),
    createdAt: new Date().toISOString(),
  };
}

/**
 * Parse a `a.b.c.d/M` CIDR into a numeric base + mask-prefix-length.
 * Limited to IPv4 — v1 of ADR-111 is IPv4-only inside the mesh.
 */
function parseCidr(cidr: string): { base: number; prefix: number } {
  const m = cidr.match(/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\/(\d{1,2})$/);
  if (!m) throw new Error(`invalid CIDR: ${cidr}`);
  const [, a, b, c, d, p] = m;
  const octets = [a, b, c, d].map(Number);
  const prefix = Number(p);
  if (octets.some(o => o < 0 || o > 255) || prefix < 0 || prefix > 32) {
    throw new Error(`out-of-range CIDR: ${cidr}`);
  }
  const base = ((octets[0] << 24) | (octets[1] << 16) | (octets[2] << 8) | octets[3]) >>> 0;
  return { base, prefix };
}

function ipToString(n: number): string {
  return `${(n >>> 24) & 0xff}.${(n >>> 16) & 0xff}.${(n >>> 8) & 0xff}.${n & 0xff}`;
}

/**
 * Derive a deterministic mesh IP for `nodeId` inside `subnet`.
 *
 * Strategy: sha256(nodeId) → top bytes interpreted as host portion of the
 * subnet, clamped to avoid the network address (.0) and broadcast (.255)
 * of any /24 inside the subnet. This is collision-resistant in the
 * birthday-paradox sense — see ADR for thresholds.
 *
 * `usedIPs` (when provided) gives previously-assigned IPs in the mesh.

View on GitHub (pinned to fa13ee4ad6)

Solutions

  1. Use a prefix length valid for the address family (0-32 for IPv4, 0-128 for IPv6).
  2. Correct out-of-range octets in the configured address.
Defensive patterns

Strategy: validation

When it happens

Trigger: A syntactically valid CIDR has an address or prefix length outside the allowed range.

Common situations: Prefix length exceeding the address family maximum (e.g. /33 for IPv4) or octets > 255.


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