I would like to know if there is someone intimately familiar with the Google sheets API who knows precisely what this error means:

Exception: API call to sheets.spreadsheets.batchUpdate failed with error: Empty response at...

It is not even feasible for me to provide a MRE that replicates the problem because my codebase is too large, and I am not even able to replicate it consistently.

Looking for a pointer to some documentation or clear explanation of this error (precisely, what an "empty response" means and why is it empty???) so that I can address this bug.

J_code's user avatar

4

"Empty response" means the HTTP layer received no parseable response at all, not a normal API-level error. There are a few causes:

Payload too large - Google recommends keeping batchUpdate payloads under 2 MB, as larger requests can be dropped by intermediate components outside Sheets' control. Chunk your requests array into smaller batches.

Server-side timeout - Sheets aborts any request taking over 180 seconds, and the Apps Script wrapper surfaces this as "Empty response" rather than a meaningful timeout message.

Apps Script execution limit - Scripts are hard-killed at 6 minutes. If the batchUpdate call is abandoned mid-flight near that ceiling, you get an empty response.

Transient server blip - A temporarily unavailable Google server can cause errors with no corresponding message.

Since you can't reproduce it consistently, #4 or #3 is most likely. The fix for all cases is the same, retry with exponential backoff, and keep individual batch payloads small.

Lakshan Rukantha's user avatar

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.