{"record":{"id":"23b47998f254bfce","repo":"tursodatabase/turso","slug":"unknown-result-type-resultkind","errorCode":null,"errorMessage":"Unknown result type: ${resultKind}","messagePattern":"Unknown result type: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"bindings/react-native/src/internal/asyncOperation.ts","lineNumber":60,"sourceCode":"    if (status === TursoStatus.DONE) {\n      // Extract and return the result based on result type\n      const resultKind = operation.resultKind();\n\n      switch (resultKind) {\n        case SyncOperationResultType.NONE:\n          return undefined as T;\n\n        case SyncOperationResultType.CONNECTION:\n          return operation.extractConnection() as T;\n\n        case SyncOperationResultType.CHANGES:\n          return operation.extractChanges() as T;\n\n        case SyncOperationResultType.STATS:\n          return operation.extractStats() as T;\n\n        default:\n          throw new Error(`Unknown result type: ${resultKind}`);\n      }\n    }\n\n    // Operation needs IO\n    if (status === TursoStatus.IO) {\n      // Process all pending IO items\n      await processIoQueue(database, context);\n\n      // Step callbacks after IO processing\n      database.ioStepCallbacks();\n\n      // Continue resume loop\n      continue;\n    }\n\n    // Any other status is an error\n    throw new Error(`Unexpected status from operation.resume(): ${status}`);\n  }","sourceCodeStart":42,"sourceCodeEnd":78,"githubUrl":"https://github.com/tursodatabase/turso/blob/bad083fafbefdeae9a42ec19bdaaad8918dcf411/bindings/react-native/src/internal/asyncOperation.ts#L42-L78","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"# before\nnpm install @tursodatabase/sync-react-native@latest\n# connect()/sync() throws: Unknown result type: 4\n\n# after\nnpm install @tursodatabase/sync-react-native@x.y.z\ncd ios && pod update && cd ..\ncd android && ./gradlew clean && cd ..\nnpx react-native start --reset-cache  # native and JS now from the same release","handlingStrategy":"try-catch","validationCode":null,"typeGuard":"function isUnknownResultType(e: unknown): boolean {\n  return e instanceof Error && /Unknown result type: \\d+/.test(e.message);\n}","tryCatchPattern":"try {\n  await db.sync();\n} catch (e) {\n  if (isUnknownResultType(e)) {\n    throw new Error('JS binding older than native sync engine — align versions and rebuild native');\n  }\n  throw e;\n}","preventionTips":["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"],"tags":["version-skew","sync","result-decoding","react-native"],"backgroundTag":"binding-version-mismatch","analyzedSha":"bad083fafbefdeae9a42ec19bdaaad8918dcf411","analyzedAt":"2026-08-16T23:12:11.798Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}