{"record":{"id":"7261481b2a918227","repo":"tursodatabase/turso","slug":"getallrows-failed-with-status-bulk-status","errorCode":null,"errorMessage":"getAllRows failed with status: ${bulk.status}","messagePattern":"getAllRows failed with status: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"bindings/react-native/src/Statement.ts","lineNumber":316,"sourceCode":"      for (let ioRetries = 0; ioRetries < MAX_IO_RETRIES; ioRetries++) {\n        const bulk = this._statement.getAllRows();\n        if (bulk.rows && bulk.rows.length > 0) {\n          rows = rows.concat(bulk.rows);\n        }\n\n        if (bulk.status === TursoStatus.DONE) {\n          return rows;\n        }\n\n        if (bulk.status === TursoStatus.IO) {\n          this._statement.runIo();\n          if (this._extraIo) {\n            await this._extraIo();\n          }\n          continue;\n        }\n\n        throw new Error(`getAllRows failed with status: ${bulk.status}`);\n      }\n\n      throw new Error(`getAllRows: exceeded ${MAX_IO_RETRIES} IO retries`);\n    } finally {\n      this._statement.reset();\n      if (this._execLock) {\n        this._execLock.release();\n      }\n    }\n  }\n\n  /**\n   * Read current row into an object\n   *\n   * @returns Row object with column name keys\n   */\n  private readRow(): Row {\n    const row: Row = {};","sourceCodeStart":298,"sourceCodeEnd":334,"githubUrl":"https://github.com/tursodatabase/turso/blob/bad083fafbefdeae9a42ec19bdaaad8918dcf411/bindings/react-native/src/Statement.ts#L298-L334","documentation":"Statement.all() uses the native getAllRows bulk path. DONE returns the rows and IO is drained by calling _statement.runIo() plus the optional _extraIo callback; every other status hits this throw with its numeric code. The value decodes against the TursoStatus enum (4=BUSY, 127=ERROR, 128=MISUSE, 133=CORRUPT, 134=IOERR), and because this is a C++-side row scan, statuses often reflect storage or contention conditions discovered mid-scan.","triggerScenarios":"A large SELECT via all() while another connection writes (BUSY 4); scanning pages that are corrupt or hit an IO error mid-bulk-read (133/134); MISUSE (128) when the statement state is invalid entering the bulk read.","commonSituations":"List screens running big all() queries during background sync writes; reading a partially-synced database whose local pages are incomplete (usually surfaces as IO first, but can degrade to ERROR); storage-level corruption after process kill.","solutions":["Decode the numeric status against the TursoStatus enum","Status 4 (BUSY): retry after backoff or avoid concurrent write/read windows","Status 133/134 (CORRUPT/IOERR): verify the database file, let sync re-download pages, check free space","Status 128 (MISUSE): ensure reset()/bind() pairing on reused statements"],"exampleFix":"// before\nconst rows = await stmt.all(); // throws: getAllRows failed with status: 4\n\n// after\nasync function allWithRetry(stmt, tries = 3) {\n  for (let i = 0; ; i++) {\n    try { return await stmt.all(); }\n    catch (e) {\n      const m = /status: (\\d+)$/.exec(String(e.message));\n      if (i < tries - 1 && m && Number(m[1]) === 4 /* BUSY */) {\n        await new Promise(r => setTimeout(r, 50 * (i + 1)));\n        continue;\n      }\n      throw e;\n    }\n  }\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":"function isStatusError(e: unknown, status: TursoStatus): boolean {\n  return e instanceof Error && e.message.endsWith(`status: ${status}`);\n}","tryCatchPattern":"try {\n  const rows = await stmt.all();\n} catch (e) {\n  if (isStatusError(e, TursoStatus.BUSY)) {\n    await new Promise(r => setTimeout(r, 100));\n    return stmt.all(); // bounded retry\n  }\n  throw e; // CORRUPT/IOERR/MISUSE need investigation, not retry\n}","preventionTips":["Decode the numeric status first; only BUSY is safely retryable","Avoid large all() scans while background sync writes are in flight","Watch for CORRUPT(133)/IOERR(134) — they indicate storage problems, not query bugs"],"tags":["status-code","bulk-read","busy","react-native","sync"],"backgroundTag":"sqlite-error-code","analyzedSha":"bad083fafbefdeae9a42ec19bdaaad8918dcf411","analyzedAt":"2026-08-16T23:12:11.798Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}