alyssaxuu/screenity · error · Error

Drive folder creation failed: ${createRes.status} ${text}

Error message

Drive folder creation failed: ${createRes.status} ${text}

What it means

The files.create POST that creates the missing 'Screenity' folder returned a non-OK status. Thrown in findOrCreateScreenityFolder only when no existing folder was found and createRes.ok is false — typically insufficient permissions, quota limits, or a transient Drive API failure.

Source

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

      `Drive folder search failed: ${searchRes.status} ${text}`
    );
  }

  const result = await searchRes.json();
  if (result.files?.length) return result.files[0].id;

  const createRes = await fetch(`https://www.googleapis.com/drive/v3/files`, {
    method: "POST",
    headers,
    body: JSON.stringify({
      name: "Screenity",
      mimeType: "application/vnd.google-apps.folder",
    }),
  });

  if (!createRes.ok) {
    const text = await createRes.text().catch(() => "");
    throw new Error(
      `Drive folder creation failed: ${createRes.status} ${text}`
    );
  }

  const newFolder = await createRes.json();
  return newFolder.id;
};

const getAuthTokenFromStorage = async () => {
  return new Promise((resolve, reject) => {
    chrome.storage.local.get(["token"], async (result) => {
      if (chrome.runtime.lastError) {
        console.error("[Drive] storage error:", chrome.runtime.lastError);
        reject(new Error(chrome.runtime.lastError));
        return;
      }

      const token = result.token;

View on GitHub (pinned to 512606387b)

Solutions

  1. Inspect `text` (Drive JSON error body) for the failure reason
  2. Retry the create with exponential backoff on 429/403-quota errors
  3. Confirm the token has permission to create folders in the user's Drive
  4. Refresh the token and retry the whole find-or-create flow once
Defensive patterns

Strategy: retry

When it happens

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