alyssaxuu/screenity · error · Error

Failed to create scene: ${errorText}

Error message

Failed to create scene: ${errorText}

What it means

CloudRecorder throws this after the background service worker's scene-create request returns a non-OK response AND the recoverScene() fallback also fails. The errorText is the raw response text or SW error forwarded from the create-scene API call, so the message surfaces the server/backend reason the scene could not be created.

Source

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

            projectId,
            sceneId,
          });
          logDebugEvent("scene-recovered", {
            projectId,
            sceneId,
          });
          sceneOutcome = "recovered";
          shouldIncrementMultiSceneCount = true;
        } else {
          logDebugEvent("scene-create-failed", {
            projectId,
            sceneId,
            error: errorText,
          });
          await setSceneCreateStatus(sceneId, "failed", {
            error: errorText,
          });
          throw new Error(`Failed to create scene: ${errorText}`);
        }
      } else {
        // Dispatch editor-ready right after the 201; housekeeping
        // (setSceneCreateStatus / removePendingScene / etc.) runs in
        // parallel below since nothing in the handoff reads it.
        sceneOutcome = "created";
        shouldIncrementMultiSceneCount = true;

        if (multiMode && shouldIncrementMultiSceneCount) {
          // Multi needs count + lastSceneId persisted before
          // reopen-popup-multi fires; that handler reads them.
          // reads them. Keep this awaited path for multi.
          await chrome.storage.local.set({
            multiSceneCount: multiSceneCount + 1,
            multiLastSceneId: sceneId,
          });
          chrome.runtime.sendMessage({
            type: "reopen-popup-multi",

View on GitHub (pinned to 512606387b)

Solutions

  1. Read errorText in the message to identify the exact server-side rejection (auth, 404 project, 500)
  2. Verify the user session/auth token is valid and the projectId exists before starting the recording
  3. Check that screen/camera/audio media uploads completed and mediaIds are populated in uploadMeta
  4. Retry the recording; the recoverScene fallback already ran, so transient backend issues will usually succeed on a new attempt
  5. Inspect setSceneCreateStatus(sceneId, 'failed', {error}) journal for the stored failure detail

Example fix

// before
throw new Error(`Failed to create scene: ${errorText}`);
// after
if (recoverResult.status === 401 || /unauthor|token/i.test(errorText)) {
  await requestReauth();
}
throw new Error(`Failed to create scene: ${errorText}`);
Defensive patterns

Strategy: try-catch

Validate before calling

const swRes = await sendSceneCreateOnce();
if (!swRes?.ok && !(await hasValidSession())) {
  throw new Error("Session expired before scene create; re-authenticate first");
}
if (!uploadMeta.screen?.mediaId && !uploadMeta.camera?.mediaId) {
  throw new Error("No uploaded media to attach to scene; abort before create");
}

Type guard

function hasStreamId(res) {
  return typeof res === "object" && res !== null && "ok" in res && res.ok === true;
}
function isRecoverableSceneCreate(res) {
  return res != null && typeof res.error === "string" && res.error.length > 0;
}

Try / catch

try {
  await createSceneViaSW(payload);
} catch (err) {
  if (/Failed to create scene:/.test(err.message)) {
    const serverReason = err.message.replace("Failed to create scene: ", "");
    if (/unauthor|401|token/i.test(serverReason)) await requestReauth();
    else await retryWithBackoff(() => createSceneViaSW(payload));
  } else throw err;
}

Prevention

When it happens

Trigger: The SW-mediated create-scene POST (after one automatic retry for 'no-bg-response'/'bg-timeout') returns res.ok === false, and recoverScene() with the uploaded screen/camera/audio mediaIds also returns { ok: false }; the code marks the scene 'failed' via setSceneCreateStatus and rethrows the server's error text.

Common situations: Backend 4xx/5xx on the scene-create endpoint (auth token expired, invalid projectId, media still processing), service worker killed mid-request so only the error string comes back, or recover-scene endpoint rejecting because mediaIds are missing or not yet linked.

Related errors


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