tursodatabase/turso · error · Error

Unknown result type

Error message

Unknown result type: ${resultKind}

What it means

After a sync operation finishes (resume() returns DONE), the driver reads resultKind() and only knows NONE, CONNECTION, CHANGES and STATS. Any other value hits the default branch and throws. Like 'Unknown column type', an out-of-enum result kind means the JS package and the native library disagree - the native side returned a value the installed JS code was never compiled to understand.

Solutions

  1. Pin the JS package and the native dependency to the same release version
  2. Rebuild cleanly after aligning versions: pod install / ./gradlew clean, reinstall the app, reset Metro cache
  3. Print the resultKind value - if it is not 0-3, include it in a bug report; if versions match, it is an SDK defect

Example fix

// before - native binary newer than the JS enum
await db.pull(); // throws `Unknown result type: 4`

// after - same release on both sides
// npm i @tursodatabase/sync-react-native@0.x.y && (cd ios && pod update Turso) || (cd android && ./gradlew clean)
Defensive patterns

Strategy: try-catch

Try / catch

try { await db.pull(); } catch (e) { if (e instanceof Error && e.message.startsWith('Unknown result type:')) { throw new Error('JS/native SDK version mismatch - rebuild the native app to match the npm package'); } throw e; }

Prevention

When it happens

Trigger: Any sync operation driven to completion - connect(), pull(), push(), sync() - where the native binary is newer (or differently built) than @tursodatabase/sync-react-native and reports a result kind the JS SyncOperationResultType enum does not contain.

Common situations: Upgrading the native pods/gradle dependency ahead of the npm package (or the reverse); building native from a feature branch while shipping the released JS package.

Related errors


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

Appendix: source

Thrown at bindings/react-native/src/internal/asyncOperation.ts:60

    if (status === TursoStatus.DONE) {
      // Extract and return the result based on result type
      const resultKind = operation.resultKind();

      switch (resultKind) {
        case SyncOperationResultType.NONE:
          return undefined as T;

        case SyncOperationResultType.CONNECTION:
          return operation.extractConnection() as T;

        case SyncOperationResultType.CHANGES:
          return operation.extractChanges() as T;

        case SyncOperationResultType.STATS:
          return operation.extractStats() as T;

        default:
          throw new Error(`Unknown result type: ${resultKind}`);
      }
    }

    // Operation needs IO
    if (status === TursoStatus.IO) {
      // Process all pending IO items
      await processIoQueue(database, context);

      // Step callbacks after IO processing
      database.ioStepCallbacks();

      // Continue resume loop
      continue;
    }

    // Any other status is an error
    throw new Error(`Unexpected status from operation.resume(): ${status}`);
  }

View on GitHub (pinned to 244cde92a7)