{"record":{"id":"df67d0f2ff98633b","repo":"gildas-lormeau/SingleFile","slug":"unknown-error-df67d0","errorCode":"unknown_error","errorMessage":"unknown_error (\" + httpResponse.status + \")","messagePattern":"unknown_error \\(\" \\+ httpResponse\\.status \\+ \"\\)","errorType":"error_code","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/lib/gdrive/gdrive.js","lineNumber":491,"sourceCode":"async function getJSON(httpResponse) {\n\thttpResponse = getResponse(httpResponse);\n\tconst response = await httpResponse.json();\n\tif (response.error) {\n\t\tthrow new Error(response.error);\n\t} else {\n\t\treturn response;\n\t}\n}\n\nfunction getResponse(httpResponse) {\n\tif (httpResponse.status == 200) {\n\t\treturn httpResponse;\n\t} else if (httpResponse.status == 404) {\n\t\tthrow new Error(\"path_not_found\");\n\t} else if (httpResponse.status == 401) {\n\t\tthrow new Error(\"invalid_token\");\n\t} else {\n\t\tthrow new Error(\"unknown_error (\" + httpResponse.status + \")\");\n\t}\n}\n","sourceCodeStart":473,"sourceCodeEnd":494,"githubUrl":"https://github.com/gildas-lormeau/SingleFile/blob/517fb7c5cf2096d89933b747e862d8ecf616a9f9/src/lib/gdrive/gdrive.js#L473-L494","documentation":"getResponse's fallback branch: any HTTP status other than 200/404/401 is thrown as \"unknown_error (<status>)\". This covers 4xx/5xx statuses the library does not specifically map — 403 (forbidden/quota), 429 (rate limit), 5xx (Google server errors), etc. The numeric status is embedded in the message, so parse it to decide on retry behavior.","triggerScenarios":"Drive API returns 403 (insufficient permissions, sharing policy, or quota exceeded), 429 (rate limiting), or 500/502/503 (Google-side outage); transient network proxies returning non-200 statuses; requests to endpoints that moved.","commonSituations":"Bulk operations hammering the API into 403 rateLimitExceeded; app lacking scope for the operation (403); Google incidents causing 5xx bursts; corporate proxies intercepting traffic.","solutions":["Parse the status from the message (e.g. /unknown_error \\((\\d+)\\)/) and branch: retry on 429/5xx with exponential backoff, surface 403 as a permissions problem to the user.","For 403, verify OAuth scopes and Drive sharing/permissions for the target resource.","Respect Retry-After headers for 429 by slowing or queueing requests.","Check Google Workspace Status Dashboard if 5xx errors cluster in time."],"exampleFix":"// before\nawait gdrive.getJSON(resp); // Error: unknown_error (429)\n// after\ntry {\n  await gdrive.getJSON(resp);\n} catch (e) {\n  const m = /unknown_error \\((\\d+)\\)/.exec(e.message);\n  if (m && (m[1] === \"429\" || m[1].startsWith(\"5\"))) {\n    await new Promise(r => setTimeout(r, 2000));\n    return retry();\n  }\n  throw e;\n}","handlingStrategy":"retry","validationCode":null,"typeGuard":"function parseUnknownStatus(e) {\n  const m = /unknown_error \\((\\d+)\\)/.exec(String(e.message));\n  return m ? Number(m[1]) : null;\n}","tryCatchPattern":"try { await gdrive.getJSON(resp); }\ncatch (e) {\n  const status = parseUnknownStatus(e);\n  if (status === 429 || (status && status >= 500)) return retryWithBackoff();\n  if (status === 403) showPermissionsHelpToUser();\n  throw e;\n}","preventionTips":["Throttle/queue bulk Drive operations to avoid 429/403 quota errors","Request only the OAuth scopes you need","Add exponential backoff with jitter for any retryable status","Monitor Google Workspace status for 5xx clusters"],"tags":["http-error","unhandled-status","gdrive","retry"],"backgroundTag":"unexpected-http-status","analyzedSha":"517fb7c5cf2096d89933b747e862d8ecf616a9f9","analyzedAt":"2026-09-01T10:05:25.770Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}