alyssaxuu/screenity · error · Error

Drive resumable init missing Location header

Error message

Drive resumable init missing Location header

What it means

The resumable init request returned success (2xx) but carried no Location header, so there is no upload session URL to PUT chunks to. A guard thrown in uploadResumable; without uploadUrl the resumable protocol cannot proceed.

Source

Thrown at src/pages/Background/drive/handleSaveToDrive.js:155

        Authorization: `Bearer ${token}`,
        "Content-Type": "application/json; charset=UTF-8",
        "X-Upload-Content-Type": blob.type || "application/octet-stream",
        "X-Upload-Content-Length": String(blob.size),
      },
      body: JSON.stringify(metadata),
    }
  );

  if (!initRes.ok) {
    const errBody = await initRes.text().catch(() => "");
    throw new Error(
      `Drive resumable init failed: ${initRes.status} ${errBody}`
    );
  }

  const uploadUrl = initRes.headers.get("location");
  if (!uploadUrl) {
    throw new Error("Drive resumable init missing Location header");
  }

  const totalSize = blob.size;
  let offset = 0;
  let stalledRounds = 0;

  // 308 = more to send (Range header has last byte received), 200/201 = done
  while (offset < totalSize) {
    const end = Math.min(offset + CHUNK_SIZE, totalSize);
    const chunkBlob = blob.slice(offset, end);
    const buffer = await chunkBlob.arrayBuffer();
    const contentRange = `bytes ${offset}-${end - 1}/${totalSize}`;

    let chunkRes = null;
    let advanced = false;
    let stalled = false;
    for (let attempt = 0; attempt < MAX_CHUNK_ATTEMPTS; attempt++) {
      try {

View on GitHub (pinned to 512606387b)

Solutions

  1. Retry the init request once — a missing Location on 2xx is usually transient or a proxy stripping headers
  2. Check for service workers/intermediaries dropping response headers
  3. Fall back to a simple multipart upload if Location is repeatedly absent
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at src/pages/Background/drive/handleSaveToDrive.js:155 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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