{"record":{"id":"bb4fa8267102a529","repo":"tursodatabase/turso","slug":"not-supported","errorCode":"NOT_SUPPORTED","errorMessage":"Sync not supported for remote databases","messagePattern":"Sync not supported for remote databases","errorType":"exception","errorClass":"LibsqlError","httpStatus":null,"severity":"error","filePath":"serverless/javascript/src/compat.ts","lineNumber":518,"sourceCode":"    await this.execLock.acquire();\n    try {\n      if (this._closed) {\n        throw new LibsqlError(\"Client is closed\", \"CLIENT_CLOSED\");\n      }\n\n      await this.session.sequence(sql);\n    } catch (error: any) {\n      if (error instanceof LibsqlError) {\n        throw error;\n      }\n      throw mapDatabaseError(error, \"EXECUTE_MULTIPLE_ERROR\");\n    } finally {\n      this.execLock.release();\n    }\n  }\n\n  async sync(): Promise<any> {\n    throw new LibsqlError(\"Sync not supported for remote databases\", \"NOT_SUPPORTED\");\n  }\n\n  close(): void {\n    this._closed = true;\n    // Note: The libSQL client interface expects synchronous close,\n    // but our underlying session needs async close. We'll fire and forget.\n    this.session.close().catch(error => {\n      console.error('Error closing session:', error);\n    });\n  }\n\n  reconnect(): void {\n    const wasOpen = !this._closed;\n    this._closed = false;\n\n    if (wasOpen) {\n      this.session.close().catch(error => {\n        console.error('Error closing session during reconnect:', error);","sourceCodeStart":500,"sourceCodeEnd":536,"githubUrl":"https://github.com/tursodatabase/turso/blob/6c7252267988c76e632af00a671e4b9788dfae13/serverless/javascript/src/compat.ts#L500-L536","documentation":"`sync()` exists on the client interface but this HTTP-only remote client throws NOT_SUPPORTED unconditionally. Syncing offline state is only meaningful for clients backed by a local embedded replica; a pure network connection has nothing to sync, so the method is a hard stub.","triggerScenarios":"Calling `await client.sync()` on a remote/serverless connection; shared app code that unconditionally syncs after migrations or on a schedule.","commonSituations":"Code shared between an embedded-replica deployment and a remote-only one; porting from an SDK or CLI where sync is supported; assuming the full client interface is implemented everywhere.","solutions":["Remove the sync() call for remote connections","Gate sync behind a client-type or config check","If offline sync is required, switch to a sync-capable setup (local file + embedded replica)"],"exampleFix":"// before\nawait client.sync();\n// after\nif (config.localPath) {\n  await replicaClient.sync(); // embedded replica only\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  await client.sync();\n} catch (e) {\n  if (e instanceof LibsqlError && e.code === 'NOT_SUPPORTED') {\n    // remote client: nothing to sync, skip\n  } else {\n    throw e;\n  }\n}","preventionTips":["Keep remote and embedded-replica code paths separate","Only call sync() on clients you know are replica-backed"],"tags":["sync","not-supported","remote","compat"],"backgroundTag":"unsupported-operation","analyzedSha":"6c7252267988c76e632af00a671e4b9788dfae13","analyzedAt":"2026-08-20T07:02:18.389Z","contentChangedAt":"2026-08-20T07:02:18.389Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}