Why a sheet that looks infinite has a hard edge
Google Sheets presents an effectively bottomless grid visually, but every sheet object has a definite row and column count stored in its metadata. A fresh sheet starts at 1000 rows by 26 columns. That metadata is what getMaxRows() and getMaxColumns() read. When you call getRange(1, 1, numRows, numCols) and numRows or numCols exceeds those stored limits, the API throws the coordinates error before it even attempts to write. The grid you see scrolling past row 1000 is Sheets rendering empty cells speculatively; the backing store hasn't actually allocated those rows.
The first time I hit this, the sheet had been truncated by a previous script that called deleteRows() to clean up old data. The max row count shrank accordingly, and a later write that used to fit cleanly started failing. Checking getMaxRows() at write time — not at import time — is the safe pattern.