{"record":{"id":"1e01413929c7c2a2","repo":"alyssaxuu/screenity","slug":"failed-to-initialize-uploaders","errorCode":null,"errorMessage":"Failed to initialize uploaders","messagePattern":"Failed to initialize uploaders","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/pages/CloudRecorder/CloudRecorder.jsx","lineNumber":7941,"sourceCode":"          projectId: videoId,\n          multiMode: Boolean(multiMode),\n        });\n\n        // Run countdown + uploader-init in parallel. maybeStartRecording\n        // polls uploadersInitialized.current at countdown-end (200ms ×\n        // 75). Saves ~2-3s vs awaiting init before the countdown.\n        traceStep(\"resetActiveTabSent\");\n        chrome.runtime.sendMessage({ type: \"reset-active-tab\" });\n\n        // Races the countdown; if it loses, capture is delayed in 200ms polls\n        // (canBeginRecording).\n        const endUploaderInit = perfSpan(\"CloudRecorder initializeUploaders\");\n        const uploaderInitStartedAt = Date.now();\n        uploadersInitialized.current = await initializeUploaders();\n        const uploaderInitMs = Date.now() - uploaderInitStartedAt;\n        endUploaderInit({ ok: Boolean(uploadersInitialized.current) });\n        if (!uploadersInitialized.current) {\n          throw new Error(\"Failed to initialize uploaders\");\n        }\n        traceStep(\"apiUploadersReady\", {\n          uploaderInitMs,\n          uploaderCreateMs: {\n            screen: screenUploader.current?.createPostMs ?? null,\n            camera: cameraUploader.current?.createPostMs ?? null,\n            audio: audioUploader.current?.createPostMs ?? null,\n          },\n        });\n\n        setStarted(true);\n        setInitProject(false);\n        if (screenStream.current) {\n          await stopPrewarm(prewarmRef.current);\n          prewarmRef.current = startPrewarm(screenStream.current);\n          preloadWebCodecsModules();\n        }\n        if (pendingStartRef.current) {","sourceCodeStart":7923,"sourceCodeEnd":7959,"githubUrl":"https://github.com/alyssaxuu/screenity/blob/512606387b8d07dda5e63bb428bd063f0a2a3ed0/src/pages/CloudRecorder/CloudRecorder.jsx#L7923-L7959","documentation":"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: ...'.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Check the perfSpan telemetry endUploaderInit({ ok: false }) and uploader createPostMs traces to see which track failed","Verify Bunny library ID / API key / auth signature generation is valid and not expired","Test network reachability to Bunny (video create POST) at recording start; retry the recording","Ensure camera/mic permission denials are handled so a single failing track doesn't fail all uploaders","Check the Bunny API status / account limits if creation consistently fails"],"exampleFix":"// before\nif (!uploadersInitialized.current) {\n  throw new Error(\"Failed to initialize uploaders\");\n}\n// after\nif (!uploadersInitialized.current) {\n  await new Promise(r => setTimeout(r, 1000));\n  uploadersInitialized.current = await initializeUploaders();\n}\nif (!uploadersInitialized.current) {\n  throw new Error(\"Failed to initialize uploaders\");\n}","handlingStrategy":"retry","validationCode":"if (!navigator.onLine) throw new Error(\"Offline: cannot initialize uploaders\");\nconst authOk = await verifyBunnySignature(libraryId, apiKey);\nif (!authOk) throw new Error(\"Bunny credentials invalid before upload init\");","typeGuard":"function uploadersAreReady(state) {\n  return state === true || (typeof state === \"object\" && state !== null &&\n    [\"screen\", \"camera\", \"audio\"].every(k => state[k] == null || typeof state[k] === \"object\"));\n}","tryCatchPattern":"try {\n  uploadersInitialized.current = await initializeUploaders();\n  if (!uploadersInitialized.current) {\n    uploadersInitialized.current = await retryWithBackoff(initializeUploaders, 2);\n  }\n  if (!uploadersInitialized.current) throw new Error(\"Failed to initialize uploaders\");\n} catch (err) {\n  sendRecordingError(\"Failed to initialize uploaders: \" + err.message);\n  await stopStreamsAndCleanup();\n}","preventionTips":["Initialize uploaders only after network and Bunny auth are confirmed","Add bounded retry with backoff around initializeUploaders","Track which uploader (screen/camera/audio) failed via per-track telemetry and degrade gracefully","Keep uploader credentials/signatures refreshed before the countdown completes"],"tags":["upload","bunny","network","recording-pipeline"],"backgroundTag":"uploader-init-failed","analyzedSha":"512606387b8d07dda5e63bb428bd063f0a2a3ed0","analyzedAt":"2026-09-02T20:59:09.419Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T02:17:09.455Z"}