{"record":{"id":"888a7b2d9602a006","repo":"gildas-lormeau/SingleFile","slug":"unknown-error-httpfinishresponse-status","errorCode":null,"errorMessage":"unknown_error (\" + httpFinishResponse.status + \")","messagePattern":"unknown_error \\(\" \\+ httpFinishResponse\\.status \\+ \"\\)","errorType":"http","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/lib/dropbox/dropbox.js","lineNumber":328,"sourceCode":"\t\t\t\tcursor: {\n\t\t\t\t\tsession_id: mediaUploader.sessionId,\n\t\t\t\t\toffset: mediaUploader.offset\n\t\t\t\t},\n\t\t\t\tcommit: {\n\t\t\t\t\tpath,\n\t\t\t\t\tmode: mediaUploader.filenameConflictAction == CONFLICT_ACTION_OVERWRITE ? \"overwrite\" : \"add\",\n\t\t\t\t\tautorename: mediaUploader.filenameConflictAction == CONFLICT_ACTION_UNIQUIFY\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\t});\n\tif (httpFinishResponse.status == 200) {\n\t\treturn getJSON(httpFinishResponse);\n\t} else if (httpFinishResponse.status == 409 && mediaUploader.filenameConflictAction == CONFLICT_ACTION_PROMPT) {\n\t\tmediaUploader.offset = 0;\n\t\treturn mediaUploader.upload();\n\t} else {\n\t\tthrow new Error(\"unknown_error (\" + httpFinishResponse.status + \")\");\n\t}\n}\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\");","sourceCodeStart":310,"sourceCodeEnd":346,"githubUrl":"https://github.com/gildas-lormeau/SingleFile/blob/517fb7c5cf2096d89933b747e862d8ecf616a9f9/src/lib/dropbox/dropbox.js#L310-L346","documentation":"In Dropbox's chunked upload 'sendFile', after the final chunk the finish request must return 200 (or 409 conflict handled with the prompt action). Any other HTTP status results in 'unknown_error (<status>)' — the library does not map the status to a more specific message.","triggerScenarios":"The Dropbox /upload/append_v2 finish call returns an unexpected status (e.g. 429 rate limit, 5xx server error, 401) that is neither 200 nor the handled 409-with-prompt case.","commonSituations":"Dropbox API outages or rate limiting during large uploads; expired/revoked access token surfacing as a non-401 status on the finish endpoint; proxy/corporate gateways returning error pages with odd statuses.","solutions":["Check the status code in the message; handle 401 by re-authenticating (refresh token) and 429 by backing off and retrying.","Retry the upload after a delay for transient 5xx/429 errors.","Verify the Dropbox access token and app permissions are still valid.","Check network/proxy interference and Dropbox service status."],"exampleFix":"// before\nawait dropbox.sendFile(...); // throws unknown_error (429)\n// after\ntry {\n  await dropbox.sendFile(...);\n} catch (e) {\n  if (/unknown_error \\((429|5\\d\\d)\\)/.test(e.message)) {\n    await delay(backoff);\n    await dropbox.sendFile(...);\n  } else throw e;\n}","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  await dropbox.sendFile(...);\n} catch (e) {\n  const m = e.message.match(/unknown_error \\((\\d+)\\)/);\n  if (m && (m[1] === '429' || m[1].startsWith('5'))) {\n    await new Promise(r => setTimeout(r, backoff));\n    return dropbox.sendFile(...);\n  }\n  throw e;\n}","preventionTips":["Implement exponential backoff for 429/5xx statuses","Refresh tokens proactively and handle 401 via re-auth","Monitor Dropbox status page during bulk upload operations"],"tags":["dropbox","http","upload"],"backgroundTag":"unexpected-http-status","analyzedSha":"517fb7c5cf2096d89933b747e862d8ecf616a9f9","analyzedAt":"2026-09-01T10:05:25.770Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}