{"record":{"id":"877a2bb5f8f6ff72","repo":"Budibase/budibase","slug":"row-does-not-exist","errorCode":null,"errorMessage":"Row does not exist.","messagePattern":"Row does not exist\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/server/src/integrations/googlesheets.ts","lineNumber":712,"sourceCode":"            const isDeprecatedSingleUser =\n              type === FieldType.BB_REFERENCE &&\n              subtype === BBReferenceFieldSubType.USER &&\n              constraints?.type !== \"array\"\n            if (isDeprecatedSingleUser && Array.isArray(row.get(key))) {\n              row.set(key, row.get(key)[0])\n            }\n          }\n        }\n        await row.save()\n        return [\n          this.buildRowObject(\n            sheet.headerValues,\n            row.toObject(),\n            row.rowNumber\n          ),\n        ]\n      } else {\n        throw new Error(\"Row does not exist.\")\n      }\n    } catch (err) {\n      console.error(\"Error reading from google sheets\", err)\n      throw err\n    }\n  }\n\n  async delete(query: { sheet: string; rowIndex: number }) {\n    await this.connect()\n    const { row } = await this.getRowByIndex(query.sheet, query.rowIndex)\n    if (row) {\n      await row.delete()\n      return [\n        {\n          deleted: query.rowIndex,\n          [GOOGLE_SHEETS_PRIMARY_KEY]: query.rowIndex,\n        },\n      ]","sourceCodeStart":694,"sourceCodeEnd":730,"githubUrl":"https://github.com/Budibase/budibase/blob/a81a902e9a8fe55b467d106765f6638f12e35c49/packages/server/src/integrations/googlesheets.ts#L694-L730","documentation":"update() reads the target row from the sheet first; when the row id (row number) supplied in the query does not resolve to an existing row — the sheet was modified, rows were deleted, or the id was wrong — it throws 'Row does not exist.' after logging the underlying read error. Errors from the sheets read are re-thrown as-is.","triggerScenarios":"Calling query({ operation: 'UPDATE_ROW' }) with an id/rowNumber that no longer exists in the sheet, or the read from google-spreadsheet fails/returns nothing for that id.","commonSituations":"Stale row ids cached from an earlier fetch after rows were deleted or the sheet reordered; concurrent edits by another user; wrong sheet targeted so the row number is out of range; API quota/network error surfaced through the same catch block.","solutions":["Re-fetch the rows (READ) to get current valid row ids, then update using a fresh id","Confirm the row id/rowNumber targets the correct sheet and still exists","Check the console error log ('Error reading from google sheets') for the underlying cause (auth, quota, network)","Handle concurrent edits — verify the sheet wasn't restructured between read and update"],"exampleFix":"// before\nawait integration.query({ operation: Operation.UPDATE_ROW, table: { name: 'Customers' }, id: 999 }) // stale id\n// after\nconst rows = await integration.query({ operation: Operation.READ, table: { name: 'Customers' } })\nconst target = rows.find(r => r.key === 'someValue')\nawait integration.query({ operation: Operation.UPDATE_ROW, table: { name: 'Customers' }, id: target.id, body: { Name: 'New' } })","handlingStrategy":"retry","validationCode":"async function refreshRowId(integration, tableName, matchFn) {\n  const rows = await integration.query({ operation: 'READ', table: { name: tableName } })\n  const fresh = rows.find(matchFn)\n  if (!fresh) throw new Error('Row not found after re-fetch')\n  return fresh.id\n}","typeGuard":null,"tryCatchPattern":"try {\n  await integration.query({ operation: 'UPDATE_ROW', id: rowId, ... })\n} catch (err) {\n  if (err.message === 'Row does not exist.') {\n    // re-fetch rows for a fresh id, then retry the update once\n  } else throw err\n}","preventionTips":["Always use row ids from a recent READ, never cached across sessions","Re-read the sheet after any delete/reorder before updating rows","Watch the logged 'Error reading from google sheets' output to distinguish not-found from auth/quota failures"],"tags":["google-sheets","row-not-found","stale-data"],"backgroundTag":"record-not-found","analyzedSha":"a81a902e9a8fe55b467d106765f6638f12e35c49","analyzedAt":"2026-08-29T01:03:10.972Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}