Hmbown/CodeWhale · error · Error
World requires contiguous version 1 pet buckets.
Error message
World requires contiguous version 1 pet buckets.
What it means
PetWorld validates every bucket with validatePetBucket and requires sequences to line up: unsegmented recordings must have b.sequence === i exactly; segmented recordings must be strictly increasing. Violations throw this error.
Solutions
- Ensure bucket sequences are 0,1,2,... for unsegmented recordings.
- For segmented recordings, ensure sequences are strictly increasing with no repeats.
- Rebuild the tape via compilePetTelemetry instead of hand-constructing buckets.
- Verify each bucket passes validatePetBucket (version 1, valid shape).
Example fix
// before
new PetWorld(points, tape.filter(b => keepCondition(b)));
// after
const filtered = tape.filter(b => keepCondition(b))
.map((b, i) => ({ ...b, sequence: i }));
new PetWorld(points, filtered); Defensive patterns
Strategy: validation
Validate before calling
function isContiguous(tape) { return tape.every((b, i) => b.sequence === i); }
if (!isContiguous(tape)) tape = tape.map((b, i) => ({ ...b, sequence: i })); Type guard
const isBucketV1 = (b) => !!b && b.version === 1 && Number.isSafeInteger(b.sequence);
Try / catch
try { new PetWorld(points, tape, interactions); } catch (e) { if (e.message.includes('contiguous')) resequenceAndRetry(tape); } Prevention
- Only build tapes via compilePetTelemetry.
- Never hand-splice bucket arrays without renumbering sequences.
When it happens
Trigger: Passing a tape with gaps or duplicate sequences to an unsegmented PetWorld; passing a non-monotonic (decreasing or repeating) sequence to a segmented recording; buckets failing validatePetBucket (e.g. wrong version or shape).
Common situations: Manually splicing tapes together; restoring from a partial export that skipped buckets; mixing segmented and unsegmented loading modes.
Understand the failure class
Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.
Related errors
- Invalid interval for
- supabase-bad-row
- 1
- A pinned task provider requires an explicit model
- A positive pull request number is required
AI-assisted analysis of Hmbown/CodeWhale@433685b202 (2026-09-15).
Data as JSON: /api/errors/7a3f715fc5a57536.
Report an issue: GitHub.
Appendix: source
Thrown at pet/src/core/pet-world.ts:100
private hasTelemetry = false;
get startTimeMs(): number { return this.origin?.frame.timeMs ?? 0; }
get endTimeMs(): number { return Math.max(this.frame.timeMs, (this.tapeLog.at(-1)?.simTimeMs ?? 0) + 400); }
get needsSegment(): boolean {
return !this.segmented && this.tapeLog.length < 1024 && this.interactionLog.length < 4096
|| this.bucketIndex >= 1024 || this.interactionIndex >= 4096;
}
constructor(points: [number, number][], tape: readonly PetBucket[] = [], interactions: readonly PetInteraction[] = [], expressionVersion: 1 | 2 = 2, segmented = false) {
if (tape.length > 216_000 || interactions.length > 100_000) throw new Error('Pet recording exceeds its input limit.');
this.sim = new PetSim(points, 0xC0FFEE, expressionVersion);
this.segmented = segmented; this.hasTelemetry = tape.length > 0;
this.tapeLog = structuredClone([...tape]);
this.interactionLog = structuredClone([...interactions]);
for (let i = 0; i < this.tape.length; i++) {
const b = this.tape[i];
validatePetBucket(b);
if (segmented ? i > 0 && b.sequence <= this.tape[i - 1].sequence : b.sequence !== i)
throw new Error('World requires contiguous version 1 pet buckets.');
}
for (let i = 0; i < this.interactionLog.length; i++) {
const e = this.interactionLog[i];
if (!Number.isFinite(e.timeMs) || e.timeMs < 0 || i > 0 && e.timeMs < this.interactionLog[i - 1].timeMs
|| !['attention', 'food'].includes(e.kind) || !Number.isFinite(e.x) || !Number.isFinite(e.y)
|| Math.abs(e.x) > 1 || Math.abs(e.y) > 1) throw new Error('Invalid pet interaction.');
}
this.hashTape(0);
this.frame = this.makeFrame(0);
this.voices = this.score.voices(this.frame);
if (segmented) this.origin = this.checkpoint();
}
checkpoint(): PetWorldCheckpoint {
return structuredClone({ petCheckpointVersion: this.segmented ? 2 : 1,
...(this.segmented ? { historyStart: (this.origin?.tick ?? this.tick), hasTelemetry: this.hasTelemetry } : {}), history: this.historyDigest(),
sim: this.sim.checkpoint(), score: this.score.checkpoint(), accumulator: this.accumulator,
tick: this.tick, bucketIndex: this.bucketIndex, interactionIndex: this.interactionIndex, branchTick: this.branchTick,View on GitHub (pinned to 433685b202)