Hmbown/CodeWhale · error · Error

Archive this pet recording before accepting more telemetry.

Error message

Archive this pet recording before accepting more telemetry.

What it means

The tapeLog is the complete replay authority for the pet, capped at 216,000 buckets (24 hours of 400ms buckets). acceptTelemetry() refuses to accept more telemetry once the cap is reached, forcing the host to archive (persist and reset) the recording first so replay state stays bounded and memory does not grow indefinitely.

Solutions

  1. Serialize/archive the current PetWorld recording (tapeLog + interaction log + checkpoints), then start or reset the world and continue accepting telemetry there
  2. Check tapeLog.length < 216000 before each acceptTelemetry and archive when approaching the cap (e.g. at 200k)
  3. Increase the archive threshold check in the host loop rather than catching the throw
  4. Split historical imports into chunks and archive between them

Example fix

// before
world.acceptTelemetry(bucket);
// after
if (world.tapeLog.length >= 216_000) {
  archiveRecording(world); // persist tape + interactions
  world = new PetWorld();   // continue with fresh recording
}
world.acceptTelemetry(bucket);
Defensive patterns

Strategy: validation

Validate before calling

function ensureCapacity(world) {
  if (world.tapeLog.length >= 216_000) {
    archiveRecording(world);
    return false; // caller must open a fresh PetWorld
  }
  return true;
}

Try / catch

try {
  world.acceptTelemetry(bucket);
} catch (e) {
  if (e.message.includes('Archive this pet recording')) {
    archiveRecording(world);
    world = new PetWorld();
    world.acceptTelemetry(bucket);
  } else throw e;
}

Prevention

When it happens

Trigger: Calling acceptTelemetry() when tapeLog.length is already 216000 — i.e. a PetWorld has been continuously receiving live packets for a full day (or replayed up to that depth) without archiving.

Common situations: A long-running pet session left open past 24 hours; a host that never implements the archive step; batch-importing a large historical recording in one go.

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/8728b1252229e650. Report an issue: GitHub.

Appendix: source

Thrown at pet/ios/Resources/pet-native.js:440

        this.voices = [];
    }
    /** Branch at the current playhead; input is journalled for the next fixed tick.
     * A live touch never needs to re-simulate the creature's entire lifetime. */
    interact(kind, x, y) {
        if (!['attention', 'food'].includes(kind) || !Number.isFinite(x) || !Number.isFinite(y) || Math.abs(x) > 1 || Math.abs(y) > 1)
            throw new Error('Invalid pet interaction.');
        if (this.branchTick !== this.tick)
            this.interactionLog.splice(this.interactionIndex);
        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) {
        (0, pet_telemetry_js_1.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 };

View on GitHub (pinned to 433685b202)