alyssaxuu/screenity · error · Error

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

Error message

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

What it means

The Drive files.list query looking for the 'Screenity' folder returned a non-OK HTTP response. Thrown in findOrCreateScreenityFolder when searchRes.ok is false — usually an expired/insufficient OAuth token, quota, or transient API error — so the upload cannot locate or create its destination folder.

Source

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

const findOrCreateScreenityFolder = async (token) => {
  const headers = new Headers({
    Authorization: `Bearer ${token}`,
    "Content-Type": "application/json",
  });

  const query = encodeURIComponent(
    `name='Screenity' and mimeType='application/vnd.google-apps.folder' and trashed=false`
  );

  const searchRes = await fetch(
    `https://www.googleapis.com/drive/v3/files?q=${query}&fields=files(id,name)`,
    { headers }
  );

  if (!searchRes.ok) {
    const text = await searchRes.text().catch(() => "");
    throw new Error(
      `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(() => "");

View on GitHub (pinned to 512606387b)

Solutions

  1. Refresh the OAuth token on 401/403 and ensure the drive/drive.file scope is granted
  2. Parse the Drive JSON error in `text` for the exact reason (rateLimitExceeded, insufficientPermissions)
  3. Back off and retry on 429/5xx per Drive API error guidance
  4. Verify the query encoding and that the Drive API is enabled for the project
Defensive patterns

Strategy: retry

When it happens

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