tursodatabase/turso · error · Error

getAllRows failed with status

Error message

getAllRows failed with status: ${bulk.status}

What it means

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.

Solutions

  1. If on a sync database, verify the authToken is valid and the remote is reachable — failed page fetches surface here as status/IO exhaustion
  2. Log bulk.status with the SQL; identify whether it is statement-specific or connection-wide by retrying a trivial query like SELECT 1
  3. Rebuild native so JS and C++ match the same package version
  4. Recover by closing and reopening the Database to reset connection state, then retry once

Example fix

// before
const users = await db.all('SELECT * FROM big_table'); // throws with status code

// after: check connection health, then retry once after reset
let users;
try {
  users = await db.all('SELECT * FROM big_table');
} catch (e) {
  await db.get('SELECT 1'); // probe: still failing means connection-level
  await resetDatabaseConnection();
  users = await db.all('SELECT * FROM big_table');
}
Defensive patterns

Strategy: retry

Validate before calling

// For sync databases, confirm auth + remote before heavy reads
// (partial-sync IO exhaustion surfaces in this same loop)
await db.get('SELECT 1'); // connection probe
const rows = await db.all('SELECT * FROM big_table');

Try / catch

try {
  return await db.all(sql, params);
} catch (e) {
  if (e instanceof Error && /getAllRows failed with status|exceeded .* IO retries/.test(e.message)) {
    await ensureSyncHealthy(db); // verify token/remote, then reset connection
    return db.all(sql, params); // one retry
  }
  throw e;
}

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Related errors


AI-assisted analysis of tursodatabase/turso@244cde92a7 (2026-08-20). Data as JSON: /api/errors/7261481b2a918227. Report an issue: GitHub.

Appendix: source

Thrown at bindings/react-native/src/Statement.ts:316

      for (let ioRetries = 0; ioRetries < MAX_IO_RETRIES; ioRetries++) {
        const bulk = this._statement.getAllRows();
        if (bulk.rows && bulk.rows.length > 0) {
          rows = rows.concat(bulk.rows);
        }

        if (bulk.status === TursoStatus.DONE) {
          return rows;
        }

        if (bulk.status === TursoStatus.IO) {
          this._statement.runIo();
          if (this._extraIo) {
            await this._extraIo();
          }
          continue;
        }

        throw new Error(`getAllRows failed with status: ${bulk.status}`);
      }

      throw new Error(`getAllRows: exceeded ${MAX_IO_RETRIES} IO retries`);
    } finally {
      this._statement.reset();
      if (this._execLock) {
        this._execLock.release();
      }
    }
  }

  /**
   * Read current row into an object
   *
   * @returns Row object with column name keys
   */
  private readRow(): Row {
    const row: Row = {};

View on GitHub (pinned to 244cde92a7)