paperclipai/paperclip · error · Error

registry is corrupt or of an unsupported version

Error message

registry is corrupt or of an unsupported version

What it means

Registry integrity check in loadRegistry: the on-disk registry.json parsed as JSON but its version is not 1 or its leases field is not an array — the file is corrupt or written by an incompatible broker version. Aborts startup rather than importing an uninterpretable lease set.

Solutions

  1. Delete or move aside the corrupt registry file so the broker can recreate it, or restore it from a backup of a supported version.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/tailscale-https-broker/src/registry.ts:44 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of paperclipai/paperclip@120ae5428f (2026-08-18). Data as JSON: /api/errors/1c802e578571327e. Report an issue: GitHub.

Appendix: source

Thrown at packages/tailscale-https-broker/src/registry.ts:44

    generationCounter: 0,
    leases: [],
    quarantinedPorts: [],
  };
}

export function loadRegistry(path: string, nodeIdentity: string): BrokerRegistry {
  let raw: string;
  try {
    raw = readFileSync(path, "utf8");
  } catch (error) {
    if ((error as NodeJS.ErrnoException).code === "ENOENT") {
      return emptyRegistry(nodeIdentity);
    }
    throw error;
  }
  const parsed = JSON.parse(raw) as BrokerRegistry;
  if (parsed.version !== 1 || !Array.isArray(parsed.leases)) {
    throw new Error("registry is corrupt or of an unsupported version");
  }
  // Compatibility with the pre-reservation development build: an existing
  // lease necessarily represented an exposed mapping.
  parsed.leases = parsed.leases.map((lease) => ({
    ...lease,
    state: lease.state === "reserved" ? "reserved" : "exposed",
    expiresAtIso: typeof lease.expiresAtIso === "string" ? lease.expiresAtIso : null,
  }));
  parsed.quarantinedPorts = Array.isArray(parsed.quarantinedPorts) ? parsed.quarantinedPorts : [];
  return parsed;
}

/**
 * Persist the registry atomically. Temp file in the same directory (same fs),
 * fsync data, rename over the target, then fsync the directory so the rename is
 * durable.
 */
export function saveRegistry(path: string, registry: BrokerRegistry): void {

View on GitHub (pinned to 120ae5428f)