Error Code 4002 - Server timeout exceeded. Request has failed.

Leibel S
Leibel S ✭✭✭✭✭✭

Does anyone have experience dealing with Error Code 4002 (Server timeout exceeded. Request has failed.), and has any ideas on how to handle it.

It seems to come up for me when i am trying to update larger sheets

Thank you

Answers

  • Lee Joramo
    Lee Joramo ✭✭✭✭✭✭

    I don't think I have seen this type of error except maybe when Smartsheet is having issues that end up appearing on the Status Board https://status.smartsheet.com/

    Being an error from Smartsheet, you may be best to contact their API support directly.

    However, since you mention this is occurring on a large sheet, I have a few questions/suggestions:

    • Are you updating many rows at once? If so, can you break up the updates into a number of smaller batches? The smaller batches could be based on splitting the rows and/or columns to be updated in each request.
    • Is the sheet "large" due to the number of Rows, Columns or Both?
    • Do you consistently get this error when running this API call with the same request (sheet, same row updates)? Or is it intermittent?
    • Does you update trigger a large number of Workflows or affect many VLOOKUPS?
    • Are there other API, Webhooks that could be running at the same time? Including ones from Third-Parties.
  • Leibel S
    Leibel S ✭✭✭✭✭✭

    Thanks for your help Lee!

    I am actually already splitting it by 400 rows at a time, you think that is too much?

    The sheet itself is large because of a combination of columns and rows.

    The sheet has some more complicated formulas...

    I don't have anything else that would be updating this at the same time

  • Lee Joramo
    Lee Joramo ✭✭✭✭✭✭

    I just looked through my code for the closest situation I have to yours. And I see that I was updating 400 rows at a time too. I have not seen these 4002 errors with my use case.

    400 must be a number used in some sample code in the API docs or Stack Overflow?

    I would suggest trying to reduce the number. I would try reducing it dramatically. Try decreasing by half (200), and then either increase or decrease by 100 depending on if it works or not. Repeat until you find a stable chunk size.

    If there are still errors, I think I would try escalating this to Smartsheet API support.

  • Leibel S
    Leibel S ✭✭✭✭✭✭

    Thanks Lee, will give it a try!

    Side point related to this, I put in an idea to implement 'idempotency' in API requests.

    Sometimes in these larger requests that takes a long time, we should be able to poll the server and see if it is completed (using a request ID etc.)

    If you didn't yet please vote on it!