tursodatabase/turso · error · Error
Unknown result type: ${resultKind}
Error message
Unknown result type: ${resultKind} What it means
runOperation() drives a native sync operation's resume() loop; when the operation completes, it switches on the native SyncOperationResultType to extract EMPTY, CONNECTION, CHANGES, or STATS results. An unrecognized numeric resultKind hits the default arm and throws. For a released pairing of JS and native this is unreachable — it signals the JS binding is older than the native sync engine it is talking to.
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 bad083fafb)
Solutions
- Align versions: bump the npm package and rebuild native (pod install / gradlew clean) in the same change
- Clear caches: Metro (--reset-cache), iOS derived data, Android build directories
- Pin both the npm version and the native revision (pod lockfile / gradle dependency) so they cannot drift
- Report it if a matched release pair still produces an unknown kind
Example fix
# before npm install @tursodatabase/sync-react-native@latest # connect()/sync() throws: Unknown result type: 4 # after npm install @tursodatabase/sync-react-native@x.y.z cd ios && pod update && cd .. cd android && ./gradlew clean && cd .. npx react-native start --reset-cache # native and JS now from the same release
Defensive patterns
Strategy: try-catch
Type guard
function isUnknownResultType(e: unknown): boolean {
return e instanceof Error && /Unknown result type: \d+/.test(e.message);
} Try / catch
try {
await db.sync();
} catch (e) {
if (isUnknownResultType(e)) {
throw new Error('JS binding older than native sync engine — align versions and rebuild native');
}
throw e;
} Prevention
- Upgrade the npm package and native module in lockstep, with pod install / gradlew clean
- Lock native revisions in the pod lockfile / gradle pins so they cannot drift past the JS package
- Add a post-upgrade smoke test that runs connect() + a trivial sync
When it happens
Trigger: Native module built from newer source that added a result kind the JS package's enum does not include; npm package and pods/gradle artifacts updated out of sync; CI caching one side but not the other.
Common situations: Upgrading the SDK by bumping package.json only; monorepos where the native module is built from source and gets newer commits than the published npm version; stale derived-data or gradle caches.
Related errors
- push() is only available for sync databases
- pull() is only available for sync databases
- stats() is only available for sync databases
- checkpoint() is only available for sync databases
- Statement execution failed with status: ${result.status}
AI-assisted analysis of tursodatabase/turso@bad083fafb (2026-08-16).
Data as JSON: /api/errors/23b47998f254bfce.
Report an issue: GitHub.