You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.

Forum Discussion

Colaman's avatar
Colaman
New member | Level 2
2 years ago

Dropbox upload file lookup_failed/incorrect_offset/

I use the upload_session/append_v2 to upload file , but it  return error when i call /upload_session/finish to save file.

 

I think offset should be the file length?  "/upload_session/finish ' response like that 

{
"error_summary": "lookup_failed/incorrect_offset/.",
"error": {
".tag": "lookup_failed",
"lookup_failed": {
".tag": "incorrect_offset",
"correct_offset": 86736
}
}
}

 

The file length is 86601 , 86736 is the content-length in  request header. I set the Content-Length: 86601in the body.

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Staff rankDropbox Staff

    A 'lookup_failed/incorrect_offset' error like this indicates that the "offset" parameter value you supplied for the upload session in the API call does not match what the server currently expects for that upload session. The "offset" value is the amount of data (in bytes) that has been uploaded so far for that upload session. The "offset" should be the file length if you've completed uploading all of the file data.

     

    Upload sessions work by having the app upload the file in pieces, across multiple requests. Each request, whether to /2/files/upload_session/start, /2/files/upload_session/append_v2, or /2/files/upload_session/finish, can contain just a piece of the file. The "Content-Length" request header for any given request should indicate the size of the piece of data being sent in that particular request only.

     

    There's an example here, written for the Dropbox JavaScript SDK, that may serve as a useful example of how the logic works for splitting the file and setting the offset.