{"record":{"id":"d12a4cb33ca8b855","repo":"gildas-lormeau/SingleFile","slug":"unknown-error","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/dropbox/dropbox.js","lineNumber":348,"sourceCode":"}\n\nasync 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 == 401) {\n\t\tthrow new Error(\"invalid_token\");\n\t} else {\n\t\tthrow new Error(\"unknown_error (\" + httpResponse.status + \")\");\n\t}\n}\n\nfunction stringify(value) {\n\treturn JSON.stringify(value).replace(ENCODED_CHARS,\n\t\tfunction (c) {\n\t\t\treturn \"\\\\u\" + (\"000\" + c.charCodeAt(0).toString(16)).slice(-4);\n\t\t}\n\t);\n}","sourceCodeStart":330,"sourceCodeEnd":358,"githubUrl":"https://github.com/gildas-lormeau/SingleFile/blob/517fb7c5cf2096d89933b747e862d8ecf616a9f9/src/lib/dropbox/dropbox.js#L330-L358","documentation":"getResponse is the central HTTP status gate for Dropbox calls: 200 passes, 401 throws 'invalid_token', and everything else throws 'unknown_error (<status>)'. Callers of any Dropbox HTTP request (list, append, getJSON) hit this for any non-200/401 status.","triggerScenarios":"Dropbox API returning 429 (rate limit), 409 (conflict), 5xx (server error), or 403 on any request routed through getResponse.","commonSituations":"Hitting Dropbox rate limits during bulk uploads/downloads; Dropbox incidents returning 5xx; revoked app permission returning 403; proxy interference returning unexpected statuses.","solutions":["Read the status from the message: 429 → retry with exponential backoff honoring rate-limit headers; 5xx → retry later.","Re-authenticate if auth-related (though 401 is mapped to invalid_token instead).","Verify app scopes/permissions on the Dropbox app console for 403s.","Check Dropbox system status and network/proxy configuration."],"exampleFix":"// before\nconst resp = await dropbox.listFiles(path); // throws unknown_error (429)\n// after\ntry {\n  const resp = await dropbox.listFiles(path);\n} catch (e) {\n  if (e.message === 'unknown_error (429)') {\n    await sleep(2000);\n    return dropbox.listFiles(path);\n  }\n  throw e;\n}","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  await dropboxCall(...);\n} catch (e) {\n  if (e.message === 'invalid_token') {\n    await reauthorize();\n  } else {\n    const m = e.message.match(/unknown_error \\((\\d+)\\)/);\n    if (m && (m[1] === '429' || m[1].startsWith('5'))) {\n      await sleep(backoff);\n      return dropboxCall(...);\n    }\n    throw e;\n  }\n}","preventionTips":["Wrap all Dropbox calls in a helper that maps statuses to actions","Rate-limit your own request volume with a queue/backoff","Watch token validity and refresh before expiry"],"tags":["dropbox","http","status-code"],"backgroundTag":"unexpected-http-status","analyzedSha":"517fb7c5cf2096d89933b747e862d8ecf616a9f9","analyzedAt":"2026-09-01T10:05:25.770Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}