alyssaxuu/screenity · error · Error

Sign-in failed

Error message

Sign-in failed

What it means

In runUploadOnce's 401-recovery path, signIn() returned a falsy token after the cached auth token was evicted, meaning the user declined the consent prompt or the identity flow failed. Thrown so saveToDrive aborts instead of proceeding without a token.

Source

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

      // chrome.identity hands back the same cached token even after the server
      // revoked it, so without this the retry replays the dead token and the
      // user is asked to sign in again on a loop.
      // No-op on Edge, where signIn uses launchWebAuthFlow and the token was
      // never in getAuthToken's cache. Raced against a timeout so a callback
      // that never fires can't wedge the retry.
      try {
        const stale = await getAuthTokenFromStorage();
        if (stale && chrome.identity?.removeCachedAuthToken) {
          await Promise.race([
            new Promise((resolve) =>
              chrome.identity.removeCachedAuthToken({ token: stale }, resolve)
            ),
            new Promise((resolve) => setTimeout(resolve, 2000)),
          ]);
        }
      } catch {}
      const refreshed = await signIn();
      if (!refreshed) throw new Error("Sign-in failed");
      await chrome.storage.local.set({ token: refreshed });
      token = refreshed;
    } else {
      token = await getAuthTokenFromStorage();
      if (!token) throw new Error("Sign-in failed");
    }

    const folderId = await findOrCreateScreenityFolder(token);
    const fileId = await uploadResumable(token, videoBlob, fileName, folderId);
    if (!fileId) throw new Error("File ID missing after upload");
    return fileId;
  };

  try {
    diagEvent("drive-upload-start", {
      blobSize: videoBlob.size,
      blobType: videoBlob.type,
    });

View on GitHub (pinned to 512606387b)

Solutions

  1. Show a 'sign in to Google Drive' prompt and let the user retry interactively
  2. Verify chrome.identity OAuth client IDs and scopes for Chrome and Edge variants
  3. Catch this in saveToDrive and surface a user-facing message with a retry button
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at src/pages/Background/drive/handleSaveToDrive.js:330 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/c7f2f436734d7ec9. Report an issue: GitHub.