alyssaxuu/screenity · error · Error

Missing sceneId in uploadMeta

Error message

Missing sceneId in uploadMeta

What it means

When finalizing a cloud recording, the upload metadata must reference the scene the media belongs to. CloudRecorder throws this error when uploadMeta.sceneId is falsy before it calls getSceneCreateStatus, because subsequent scene-creation/status calls cannot proceed without a scene identifier.

Source

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

      "multiSceneCount",
      "multiLastSceneId",
      "activeSceneId",
      "recordingToScene",
      "recordedTabDomain",
      "recordingType",
    ]);

    const { cameraFlipped } = await chrome.storage.local.get(["cameraFlipped"]);

    let insertAfterSceneId = null;
    if (multiMode) {
      insertAfterSceneId = multiLastSceneId || activeSceneId;
    } else {
      insertAfterSceneId = activeSceneId;
    }

    if (!uploadMeta.sceneId) {
      throw new Error("Missing sceneId in uploadMeta");
    }

    if (!uploadMeta.screen?.mediaId && !uploadMeta.camera?.mediaId) {
      throw new Error(
        "No valid media uploaded - both screen and camera mediaId are missing",
      );
    }

    const sceneId = uploadMeta.sceneId;
    const existingStatus = await getSceneCreateStatus(sceneId);
    let sceneOutcome = null;
    let shouldIncrementMultiSceneCount = false;

    if (existingStatus?.status === "created") {
      logDebugEvent("scene-create-skip", {
        projectId,
        sceneId,
      });

View on GitHub (pinned to 512606387b)

Solutions

  1. Validate at recording start: do not begin capture until a sceneId exists (create a scene eagerly if none).
  2. Ensure the scene-creation call at recorder init is awaited and its errors surfaced/retried so activeSceneId is always populated.
  3. When building uploadMeta in the upload-finished callback, pass the sceneId explicitly from the recording session state instead of relying on possibly-empty activeSceneId.
  4. Wrap the finalize path so this error cancels/rolls back the recording session with a clear user message rather than leaving orphaned uploads.
  5. Check for page refreshes/state resets during recording that clear activeSceneId; persist it alongside the recording session.

Example fix

// before
if (!uploadMeta.sceneId) {
  throw new Error("Missing sceneId in uploadMeta");
}
// after
if (!uploadMeta.sceneId) {
  uploadMeta.sceneId = await ensureSceneExists({ projectId, insertAfterSceneId });
}
Defensive patterns

Strategy: validation

Validate before calling

if (!uploadMeta?.sceneId) {
  throw new Error("Refusing to finalize: uploadMeta.sceneId is not set");
}

Type guard

function hasSceneId(meta) {
  return typeof meta?.sceneId === "string" && meta.sceneId.length > 0;
}

Try / catch

try {
  await finalizeUpload(uploadMeta);
} catch (err) {
  if (err.message === "Missing sceneId in uploadMeta") {
    const scene = await createScene({ projectId });
    await finalizeUpload({ ...uploadMeta, sceneId: scene.id });
  } else {
    throw err;
  }
}

Prevention

When it happens

Trigger: Recording completes and onUploadFinished builds uploadMeta without a sceneId — e.g. recording started before any scene existed, scene creation request failed silently, or activeSceneId/insertAfterSceneId resolved to undefined at stop time.

Common situations: User starts recording immediately on a fresh project before the initial scene is created; scene-creation API call failed at record start but recording continued; state lost after a service-worker or page restart mid-recording; multi-scene logic (multiLastSceneId/activeSceneId) both undefined.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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