tursodatabase/turso · error · Error

Unknown column type

Error message

Unknown column type: ${kind}

What it means

Statement.readColumnValue() switches on the native rowValueKind() and only handles TursoType.NULL, INTEGER, REAL, TEXT and BLOB. Anything else - most notably TursoType.UNKNOWN (0) - hits the default branch and throws. The value's type code came back outside the set the JS side knows, which almost always means the JS package and the native binary disagree (e.g. a newer native layer, or a broken JSI read).

Solutions

  1. Rebuild the native side so it matches the npm package version: cd ios && pod install, or ./gradlew clean on Android, then reinstall the app (not just Metro reload)
  2. Verify package.json and the native dependency pin the same release of the Turso RN SDK
  3. If versions match and it persists on a specific query/value, print the kind number and file an issue - it identifies the exact unmapped type

Example fix

// before - version skew: JS enum has no value for what native returns
const rows = await stmt.all(); // throws `Unknown column type: 0`

// after - lock both sides to one release and rebuild
// package.json: "@tursodatabase/sync-react-native": "0.x.y"
// ios: pod install ; android: ./gradlew clean && rebuild, then reinstall the app
Defensive patterns

Strategy: try-catch

Try / catch

try { rows = await stmt.all(); } catch (e) { if (e instanceof Error && e.message.startsWith('Unknown column type:')) { // type enum out of range -> native/JS skew, rebuild native throw new Error('Native module out of sync with JS package - rebuild with pod install / gradle clean'); } throw e; }

Prevention

When it happens

Trigger: stmt.get()/stmt.all() reading a row where rowValueKind() returns 0 (UNKNOWN) or a value not present in the JS TursoType enum; typically after upgrading the npm package without rebuilding the native module, or vice versa.

Common situations: Version skew between @tursodatabase/sync-react-native and the installed pods/gradle dependency; a native build from a different branch that numbers or extends the type enum differently.

Related errors


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

Appendix: source

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

    switch (kind) {
      case TursoType.NULL:
        return null;

      case TursoType.INTEGER:
        return this._statement.rowValueInt(index);

      case TursoType.REAL:
        return this._statement.rowValueDouble(index);

      case TursoType.TEXT:
        // Use rowValueText which directly returns a string from C++ (avoids encoding issues)
        return this._statement.rowValueText(index);

      case TursoType.BLOB:
        return this._statement.rowValueBytesPtr(index) || new ArrayBuffer(0);

      default:
        throw new Error(`Unknown column type: ${kind}`);
    }
  }

  /**
   * Reset statement for re-execution
   *
   * @returns this for chaining
   */
  reset(): this {
    if (this._finalized) {
      throw new Error('Statement has been finalized');
    }

    this._statement.reset();
    return this;
  }

  /**

View on GitHub (pinned to 244cde92a7)