alyssaxuu/screenity · error · Error

Failed to initialize uploaders

Error message

Failed to initialize uploaders

What it means

initializeUploaders() resolves falsy when one or more Bunny tus uploaders (screen/camera/audio) could not be created or initialized; the pipeline throws this to abort recording start since media cannot be uploaded without uploaders. It is reported to the user as 'Failed to initialize uploaders: ...'.

Source

Thrown at src/pages/CloudRecorder/CloudRecorder.jsx:7941

          projectId: videoId,
          multiMode: Boolean(multiMode),
        });

        // Run countdown + uploader-init in parallel. maybeStartRecording
        // polls uploadersInitialized.current at countdown-end (200ms ×
        // 75). Saves ~2-3s vs awaiting init before the countdown.
        traceStep("resetActiveTabSent");
        chrome.runtime.sendMessage({ type: "reset-active-tab" });

        // Races the countdown; if it loses, capture is delayed in 200ms polls
        // (canBeginRecording).
        const endUploaderInit = perfSpan("CloudRecorder initializeUploaders");
        const uploaderInitStartedAt = Date.now();
        uploadersInitialized.current = await initializeUploaders();
        const uploaderInitMs = Date.now() - uploaderInitStartedAt;
        endUploaderInit({ ok: Boolean(uploadersInitialized.current) });
        if (!uploadersInitialized.current) {
          throw new Error("Failed to initialize uploaders");
        }
        traceStep("apiUploadersReady", {
          uploaderInitMs,
          uploaderCreateMs: {
            screen: screenUploader.current?.createPostMs ?? null,
            camera: cameraUploader.current?.createPostMs ?? null,
            audio: audioUploader.current?.createPostMs ?? null,
          },
        });

        setStarted(true);
        setInitProject(false);
        if (screenStream.current) {
          await stopPrewarm(prewarmRef.current);
          prewarmRef.current = startPrewarm(screenStream.current);
          preloadWebCodecsModules();
        }
        if (pendingStartRef.current) {

View on GitHub (pinned to 512606387b)

Solutions

  1. Check the perfSpan telemetry endUploaderInit({ ok: false }) and uploader createPostMs traces to see which track failed
  2. Verify Bunny library ID / API key / auth signature generation is valid and not expired
  3. Test network reachability to Bunny (video create POST) at recording start; retry the recording
  4. Ensure camera/mic permission denials are handled so a single failing track doesn't fail all uploaders
  5. Check the Bunny API status / account limits if creation consistently fails

Example fix

// before
if (!uploadersInitialized.current) {
  throw new Error("Failed to initialize uploaders");
}
// after
if (!uploadersInitialized.current) {
  await new Promise(r => setTimeout(r, 1000));
  uploadersInitialized.current = await initializeUploaders();
}
if (!uploadersInitialized.current) {
  throw new Error("Failed to initialize uploaders");
}
Defensive patterns

Strategy: retry

Validate before calling

if (!navigator.onLine) throw new Error("Offline: cannot initialize uploaders");
const authOk = await verifyBunnySignature(libraryId, apiKey);
if (!authOk) throw new Error("Bunny credentials invalid before upload init");

Type guard

function uploadersAreReady(state) {
  return state === true || (typeof state === "object" && state !== null &&
    ["screen", "camera", "audio"].every(k => state[k] == null || typeof state[k] === "object"));
}

Try / catch

try {
  uploadersInitialized.current = await initializeUploaders();
  if (!uploadersInitialized.current) {
    uploadersInitialized.current = await retryWithBackoff(initializeUploaders, 2);
  }
  if (!uploadersInitialized.current) throw new Error("Failed to initialize uploaders");
} catch (err) {
  sendRecordingError("Failed to initialize uploaders: " + err.message);
  await stopStreamsAndCleanup();
}

Prevention

When it happens

Trigger: initializeUploaders() returns false/undefined after uploader construction (Bunny API video-create calls fail, auth signature generation fails, or network errors), and the maybeStartRecording countdown then blocks because canBeginRecording polls uploadersInitialized.current.

Common situations: Bunny Stream API outage or rate limiting during video creation, expired upload auth signature/library credentials, offline network after stream capture succeeded, or a bug where one uploader (e.g. camera denied) fails and the whole init reports failure.

Related errors


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