JuliusBrussee/caveman · error · Error

runtimePolicy publicKey must be a base64-encoded 32-byte Ed2

Error message

runtimePolicy publicKey must be a base64-encoded 32-byte Ed25519 key

What it means

Error "runtimePolicy publicKey must be a base64-encoded 32-byte Ed25519 key" thrown in JuliusBrussee/caveman.

Source

Thrown at packages/sdk/typescript/src/index.ts:1082

 * failure. `decide()` is synchronous, local-only, and never throws — with no
 * bundle it returns the caller's baseline. Mirrors the Python
 * `RuntimePolicyClient`.
 */
export class RuntimePolicyClient {
  private bundle: Record<string, unknown> | null = null;
  private signedBundle = false;
  private pinnedKey: Uint8Array | null = null;
  private killedLocally = false;
  private timer: ReturnType<typeof setInterval> | null = null;
  /** True while a `refresh()` is in flight; the background timer skips rather than pile on. */
  private refreshing = false;
  private readonly killEnv: string;

  constructor(private cave: Cave, options: RuntimePolicyOptions = {}) {
    this.killEnv = options.killEnv ?? "CAVEMAN_POLICY_KILL";
    if (options.publicKey !== undefined) {
      const pin = base64Bytes(options.publicKey);
      if (pin === null || pin.length !== 32) throw new Error("runtimePolicy publicKey must be a base64-encoded 32-byte Ed25519 key");
      this.pinnedKey = pin;
    }
    const seconds = options.autoRefreshSeconds;
    if (typeof seconds === "number" && Number.isFinite(seconds) && seconds > 0) {
      const timer = setInterval(() => {
        // A slow or hung endpoint must not queue refreshes behind each other:
        // one tick while a refresh is already in flight is skipped, not stacked.
        if (this.refreshing) return;
        void this.refresh();
      }, seconds * 1000);
      (timer as unknown as { unref?: () => void }).unref?.();
      this.timer = timer;
    }
  }

  /**
   * Fetch and verify the current bundle (`GET /sdk/v1/runtime-policy`).
   *

View on GitHub (pinned to 27d5a3981a)

Solutions

  1. Set runtimePolicy.publicKey to a base64-encoded 32-byte Ed25519 public key.

When it happens

Trigger: Thrown at packages/sdk/typescript/src/index.ts:1082 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of JuliusBrussee/caveman@27d5a3981a (2026-08-15). Data as JSON: /api/errors/078f4c0f8423e1f1. Report an issue: GitHub.