alyssaxuu/screenity · error · Error

Uploader in error state: ${this.error}

Error message

Uploader in error state: ${this.error}

What it means

Once write() has failed and set status to 'error', all subsequent writes are rejected with this message carrying the stored this.error reason. It prevents continuing to PATCH chunks on a broken session.

Source

Thrown at src/pages/CloudRecorder/bunnyTusUploader.js:1276

        mediaId: this.mediaId,
        uploadUrl: this.uploadUrl,
        signature: this.signature,
        expires: this.expires,
      });
    }
  }

  async write(chunk) {
    if (this.isFinalizing) {
      this.bytesLostAfterFinalize += chunk?.size || 0;
      this.setUploaderError("write-after-finalize");
      throw new Error("Cannot write during finalization");
    }
    if (this.isPaused) throw new Error("Uploader paused");
    if (!this.uploadUrl) throw new Error("Uploader not initialized");

    if (this.status === "error") {
      throw new Error(`Uploader in error state: ${this.error}`);
    }

    await this.checkAuthExpiration();
    this.status = "uploading";
    if (!this.hasEmittedClientStarted) {
      this.hasEmittedClientStarted = true;
      this.emitTelemetry("upload_client_started");
    }

    for (let i = 0; i < chunk.size; i += this.CHUNK_SIZE) {
      const subChunk = chunk.slice(i, i + this.CHUNK_SIZE);
      this.chunkQueue.push(subChunk);
      this.queuedBytes += subChunk.size;
      this.totalBytes += subChunk.size;
    }
    this.lastChunkQueuedAt = Date.now();
    this.scheduleJournalPersist();

View on GitHub (pinned to 512606387b)

Solutions

  1. Inspect this.error / the 'Uploader in error state' suffix to find the root cause and fix that first
  2. Use the uploader's retry/reset mechanism (or create a new session) before resuming writes
  3. Stop the feeding pipeline (recorder) when a write rejects instead of continuing to call write
  4. Add a status check in callers before each write

Example fix

// before
for (const chunk of chunks) await uploader.write(chunk);
// after
for (const chunk of chunks) {
  if (uploader.status === "error") { await uploader.retry(); }
  await uploader.write(chunk);
}
Defensive patterns

Strategy: validation

Validate before calling

if (uploader.status === "error") {
  await uploader.retryOrRecreate(); // reset before more writes
}

Type guard

function canWrite(uploader) { return uploader.status !== "error" && !!uploader.uploadUrl; }

Try / catch

try {
  await uploader.write(chunk);
} catch (e) {
  if (String(e.message).startsWith("Uploader in error state")) {
    console.error("root cause:", e.message); // suffix names the original error
    stopRecorderFeed(); // stop pushing chunks on a broken session
  }
}

Prevention

When it happens

Trigger: Calling write() after a previous write/PATCH failed (network error, auth expiry, untrusted location, etc.) which put the uploader into status 'error'.

Common situations: Retrying writes after a failed chunk without calling a reset/retry path; ignoring a rejected write promise earlier in the stream and continuing to feed chunks.

Related errors


AI-assisted analysis of alyssaxuu/screenity@512606387b (2026-09-02). Data as JSON: /api/errors/6d4399ef0bc853e8. Report an issue: GitHub.