Hmbown/CodeWhale · error · Error

Live pet input exceeds its tail limit.

Error message

Live pet input exceeds its tail limit.

What it means

PetLiveTape.accept() only accepts a bounded tail of live file input (256 KiB). If the supplied text exceeds that limit, the cursor is reset (establishing a baseline) and the input is rejected, so an unbounded read can never flood the live pipeline.

Solutions

  1. Read only the trailing bytes/tail of the live file (bounded to <=256 KiB) before calling accept().
  2. Track your own file offset and pass only the newly appended chunk.
  3. Reset the live cursor after suspension or re-attachment, then re-accept from a fresh bounded tail.
  4. Rotate the underlying tape file so it stays small.

Example fix

// before
live.accept(await readFile(path, 'utf8'));
// after
const text = await readFile(path, 'utf8');
live.accept(text.slice(-262144)); // or track offset and pass only the new chunk
Defensive patterns

Strategy: try-catch

Validate before calling

if (typeof chunk === 'string' && chunk.length > 262144) chunk = chunk.slice(-262144); // or track offset and pass only new bytes
live.accept(chunk);

Try / catch

try { live.accept(text); }
catch (e) { if (e.message === 'Live pet input exceeds its tail limit.') { live.reset(); live.accept(text.slice(-262144)); } else throw e; }

Prevention

When it happens

Trigger: Calling accept() with a string longer than 262,144 characters — usually from reading the whole live tape file instead of its tail, or from a file that grew huge between polls.

Common situations: A driver reading the full file on first poll instead of a bounded tail; a file watcher passing the entire changed file; very large accumulated tape due to missing rotation.

Understand the failure class

Background: payload too large / request exceeds maximum size: why libraries cap bytes and how to fix oversize payloads — this error's family across 50 libraries.

Related errors


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

Appendix: source

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

        throw new Error('Pet tape exceeds 24 hours.');
    return rows.map((row, i) => { validatePetBucket(row); if (row.sequence !== i)
        throw new Error('Non-contiguous pet tape.'); return row; });
}
/** A live file must advance before its contents count as a new observation.
 * Existing bytes, duplicate samples and a restarted sequence establish a
 * baseline; they never replay an old onset or human request. Drivers supply a
 * bounded tail and reset this cursor after suspension or a new attachment. */
class PetLiveTape {
    sequence;
    reset() { this.sequence = undefined; }
    readTail(text) {
        if (!text) {
            this.reset();
            return;
        }
        if (text.length > 262_144) {
            this.reset();
            throw new Error('Live pet input exceeds its tail limit.');
        }
        if (!text.endsWith('\n'))
            return;
        const line = text.trimEnd().split('\n').at(-1);
        if (!line)
            return;
        let packet;
        try {
            packet = JSON.parse(line);
            validatePetBucket(packet);
        }
        catch (error) {
            this.reset();
            throw error;
        }
        const previous = this.sequence;
        this.sequence = packet.sequence;
        if (previous === undefined || packet.sequence <= previous)

View on GitHub (pinned to 433685b202)