{"record":{"id":"1305a56d8f6253d7","repo":"IceWhaleTech/CasaOS","slug":"s-v","errorCode":null,"errorMessage":"%s: %v","messagePattern":"%s: %v","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"drivers/dropbox/util.go","lineNumber":85,"sourceCode":"\t}\n\tif resp != nil {\n\t\treq.SetResult(resp)\n\t}\n\tvar e Error\n\treq.SetError(&e)\n\tres, err := req.Execute(method, url)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif e.Error.Code != 0 {\n\t\tif e.Error.Code == 401 {\n\t\t\terr = d.refreshToken()\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn d.request(url, method, callback, resp)\n\t\t}\n\t\treturn nil, fmt.Errorf(\"%s: %v\", e.Error.Message, e.Error.Errors)\n\t}\n\treturn res.Body(), nil\n}\nfunc (d *Dropbox) getFiles(path string) ([]File, error) {\n\n\tres := make([]File, 0)\n\tvar resp Files\n\tbody := base.Json{\n\t\t\"limit\": 2000,\n\t\t\"path\":  path,\n\t}\n\n\t_, err := d.request(\"https://api.dropboxapi.com/2/files/list_folder\", http.MethodPost, func(req *resty.Request) {\n\t\treq.SetBody(body)\n\t}, &resp)\n\tif err != nil {\n\t\treturn nil, err\n\t}","sourceCodeStart":67,"sourceCodeEnd":103,"githubUrl":"https://github.com/IceWhaleTech/CasaOS/blob/0d3b2f444ec0193193cf03eef6d43c6e35b0183e/drivers/dropbox/util.go#L67-L103","documentation":"A Dropbox content/API call returned an error body with a non-zero code that is not 401, and the driver formats the endpoint's summary message plus the detailed Errors slice into '%s: %v'. The 401 branch auto-refreshes the token and retries once; every other code surfaces here.","triggerScenarios":"Any Dropbox request after authentication succeeds but the API rejects the operation: 409 conflict (path/conflict/), 403 (no write permission / rate limited), 400 (malformed path or invalid cursor), 429 too_many_requests.","commonSituations":"Uploading to a path that already exists with conflict; operating on a file deleted by another client; app permissions missing 'files.content.write'; hitting Dropbox rate limits during bulk syncs.","solutions":["Read the Errors slice in the message — Dropbox includes a structured tag like 'path/conflict/file' that names the exact cause.","For 409 conflicts: list the destination first and use Move/Rename to overwrite or pick a unique name.","For permission errors: check the app's permission scopes in the Dropbox App Console and re-grant.","For 429: retry with the Retry-After delay and reduce request concurrency."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"_, err := d.request(url, method, cb, resp)\nif err != nil {\n\tmsg := err.Error()\n\tswitch {\n\tcase strings.Contains(msg, \"too_many_requests\"): // 429: back off and retry\n\t\ttime.Sleep(retryAfter)\n\t\treturn d.request(url, method, cb, resp)\n\tcase strings.Contains(msg, \"conflict\"): // 409: resolve name/target first\n\t\treturn resolveConflictThenRetry()\n\t}\n\treturn err // 4xx permanent: fix scope/path, do not loop\n}","preventionTips":["Check destination paths exist (and names are unique) before writes to avoid 409s","Confirm app scopes include files.content.read/write in the App Console","Cap concurrent Dropbox calls below rate limits and honor Retry-After"],"tags":["dropbox","api-error","http","conflict"],"backgroundTag":null,"analyzedSha":"0d3b2f444ec0193193cf03eef6d43c6e35b0183e","analyzedAt":"2026-08-15T13:27:57.821Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}