Hmbown/CodeWhale · error · Error

Archive the legacy recording before accepting more…

Error message

Archive the legacy recording before accepting more telemetry.

What it means

In the non-segmented (legacy) tape mode, acceptTelemetry() pads the tapeLog up to the incoming sequence number and throws if the sequence reaches 216,000 — the legacy recording has hit its maximum length. The recording must be archived and a new world started; no further legacy buckets are accepted.

Solutions

  1. Archive the legacy recording and start a fresh PetWorld for continued telemetry.
  2. Migrate to segmented tape mode (the 'segmented' path in acceptTelemetry), which handles long recordings without the legacy sequence cap.
  3. Pause simulation before the tick count reaches ~2,592,000 (216,000 × 12) if the legacy format must be kept.
  4. Check the current sequence before accepting to stop cleanly at the boundary.

Example fix

// before
world.acceptTelemetry(bucket); // legacy tape, sequence >= 216000
// after
if (world.tick / 12 >= 216_000) { archive(world); world = new PetWorld(...); }
world.acceptTelemetry(bucket);
Defensive patterns

Strategy: try-catch

Validate before calling

const sequence = Math.floor(world.tick / 12) + 1;
if (!world.segmented && sequence >= 216_000) archiveAndRotate(world);

Type guard

null

Try / catch

try { world.acceptTelemetry(bucket); } catch (e) { if (/Archive the legacy recording/.test(e.message)) { await archive(world); migrateToSegmentedOrRestart(); } else throw e; }

Prevention

When it happens

Trigger: Calling acceptTelemetry() in legacy (non-segmented) mode once Math.floor(tick / 12) + 1 >= 216,000 — i.e. after ~24 simulated hours of ticks in legacy tape mode.

Common situations: A session that has run the simulation past the legacy tape's capacity; importing a legacy recording that is already near its maximum sequence and appending to it; running a long replay where the tape format predates segmented storage.

Understand the failure class

Background: "File too large" / "file size exceeds limit" errors: why libraries cap file sizes and how to fix them — this error's family across 46 libraries.

Related errors


AI-assisted analysis of Hmbown/CodeWhale@433685b202 (2026-09-15). Data as JSON: /api/errors/0b5bc386184ac6da. Report an issue: GitHub.

Appendix: source

Thrown at pet/src/core/pet-world.ts:302

    this.branchTick = this.tick;
    this.interactionLog.push({ timeMs: (this.tick + 1) * 1000 / HZ, kind, x, y });
  }

  /** Accept a live source packet at the next 400ms boundary. The accepted tape,
   * including any missing intervals, is the exact replay authority for this host. */
  acceptTelemetry(input: PetBucket): void {
    validatePetBucket(input);
    const sequence = Math.floor(this.tick / 12) + 1;
    if (this.tapeLog.length >= 216_000) throw new Error('Archive this pet recording before accepting more telemetry.');
    this.hasTelemetry = true;
    if (this.segmented) {
      const at = this.tapeLog.findIndex(b => b.sequence >= sequence);
      const index = at < 0 ? this.tapeLog.length : at;
      this.tapeLog.splice(index, at >= 0 && this.tapeLog[at].sequence === sequence ? 1 : 0,
        { ...structuredClone(input), sequence, simTimeMs: sequence * 400 });
      this.hashTape(index); return;
    }
    if (sequence >= 216_000) throw new Error('Archive the legacy recording before accepting more telemetry.');
    const changedFrom = Math.min(sequence, this.tapeLog.length);
    while (this.tapeLog.length <= sequence) {
      const at = this.tapeLog.length;
      this.tapeLog.push({ version: 1, sequence: at, simTimeMs: at * 400, durationMs: 400,
        activity: .12, coherence: .25, attention: 0, channel: 'other', observed: 0, roamX: 0, roamY: 0, flip: 1, lit: 1,
        onsets: Array(13).fill(0), activeMs: Array(13).fill(0), errors: 0, agentIds: [], waiting: false });
    }
    this.tapeLog[sequence] = { ...structuredClone(input), sequence, simTimeMs: sequence * 400 };
    this.hashTape(changedFrom);
  }

  /** dt is bounded so suspending a surface cannot cause an unbounded catch-up. */
  step(dt: number, opts: PetOpts = { motion: true, sensitivity: 1 }): WorldFrame {
    if (!Number.isFinite(dt) || dt < 0 || dt > 10) throw new Error('World dt must be in [0, 10] seconds.');
    this.accumulator += dt;
    this.voices = [];
    while (this.accumulator + 1e-10 >= 1 / HZ) {
      this.accumulator -= 1 / HZ;

View on GitHub (pinned to 433685b202)