{"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/244cde92a7df7f9b8b8b7a4075c35a12977e303e/bindings/react-native/src/Statement.ts#L298-L334","documentation":"all() loops the native bulk read: DONE returns the accumulated rows, IO triggers runIo() plus draining the sync engine (partial-sync page fetch) and retries, up to MAX_IO_RETRIES. Any status that is not DONE or IO escapes the loop as `getAllRows failed with status: N` — a native-level read failure, not a data problem.","triggerScenarios":"A bulk read returning an unexpected native status (error/invalid state) mid-iteration; exceeding MAX_IO_RETRIES IO rounds during partial sync when pages keep failing to load (that sibling message shares the same loop).","commonSituations":"Sync databases in partial-sync mode where the IO queue stalls (remote unreachable mid-read, auth token expired so page fetches fail repeatedly); JS/native version mismatch after upgrading only one side; connection state corrupted by an earlier error.","solutions":["If on a sync database, verify the authToken is valid and the remote is reachable — failed page fetches surface here as status/IO exhaustion","Log bulk.status with the SQL; identify whether it is statement-specific or connection-wide by retrying a trivial query like SELECT 1","Rebuild native so JS and C++ match the same package version","Recover by closing and reopening the Database to reset connection state, then retry once"],"exampleFix":"// before\nconst users = await db.all('SELECT * FROM big_table'); // throws with status code\n\n// after: check connection health, then retry once after reset\nlet users;\ntry {\n  users = await db.all('SELECT * FROM big_table');\n} catch (e) {\n  await db.get('SELECT 1'); // probe: still failing means connection-level\n  await resetDatabaseConnection();\n  users = await db.all('SELECT * FROM big_table');\n}","handlingStrategy":"retry","validationCode":"// For sync databases, confirm auth + remote before heavy reads\n// (partial-sync IO exhaustion surfaces in this same loop)\nawait db.get('SELECT 1'); // connection probe\nconst rows = await db.all('SELECT * FROM big_table');","typeGuard":null,"tryCatchPattern":"try {\n  return await db.all(sql, params);\n} catch (e) {\n  if (e instanceof Error && /getAllRows failed with status|exceeded .* IO retries/.test(e.message)) {\n    await ensureSyncHealthy(db); // verify token/remote, then reset connection\n    return db.all(sql, params); // one retry\n  }\n  throw e;\n}","preventionTips":["Keep sync auth tokens fresh — expired tokens make partial-sync page fetches fail repeatedly and exhaust IO retries here","Rebuild native together with JS upgrades to avoid status-code mismatches","Probe with 'SELECT 1' to classify connection-wide failures before retrying large reads"],"tags":["react-native","statement","native-error","partial-sync","status-code"],"backgroundTag":"statement-status-error","analyzedSha":"244cde92a7df7f9b8b8b7a4075c35a12977e303e","analyzedAt":"2026-08-20T07:02:18.389Z","contentChangedAt":"2026-08-20T07:02:18.389Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}