{"record":{"id":"c292333bbfb54ceb","repo":"tursodatabase/turso","slug":"advanced-sync-options-require-a-remote-embedded-re","errorCode":null,"errorMessage":"Advanced sync options require a remote embedded replica connection.","messagePattern":"Advanced sync options require a remote embedded replica connection\\.","errorType":"validation","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"bindings/dotnet/src/Turso.Data/TursoConnection.cs","lineNumber":651,"sourceCode":"\n            Volatile.Write(ref _automaticSyncStatus, args.Status);\n            generation = Volatile.Read(ref _automaticSyncGeneration);\n            handlers = AutomaticSyncStatusChanged;\n        }\n\n        QueueAutomaticSyncStatusChanged(handlers, args.Status, generation);\n    }\n\n    private void ValidateLocalOnlyOptions()\n    {\n        if (!string.IsNullOrWhiteSpace(_connectionOptions.AuthToken))\n            throw new InvalidOperationException(\"Auth Token requires a remote Turso URL Data Source.\");\n        if (!string.IsNullOrWhiteSpace(_connectionOptions.ReplicaPath))\n            throw new InvalidOperationException(\"Replica Path requires a remote Turso URL Data Source.\");\n        if (_connectionOptions.SyncInterval > 0)\n            throw new InvalidOperationException(\"Sync Interval requires a remote embedded replica connection.\");\n        if (_connectionOptions.HasAdvancedReplicaOptions)\n            throw new InvalidOperationException(\"Advanced sync options require a remote embedded replica connection.\");\n        if (_connectionOptions.Tls.HasValue)\n            throw new InvalidOperationException(\"Tls requires a remote Turso URL Data Source.\");\n    }\n\n    private void CloseRemote()\n    {\n        var remoteClient = _remoteClient;\n        if (remoteClient is null)\n            return;\n\n        Exception? closeError = null;\n        try\n        {\n            if (_remoteTransactionActive)\n            {\n                if (_remoteTransactionFailure is null)\n                {\n                    remoteClient","sourceCodeStart":633,"sourceCodeEnd":669,"githubUrl":"https://github.com/tursodatabase/turso/blob/6c7252267988c76e632af00a671e4b9788dfae13/bindings/dotnet/src/Turso.Data/TursoConnection.cs#L633-L669","documentation":"Advanced replica sync options (partial sync, remote encryption, etc., exposed via HasAdvancedReplicaOptions) only make sense when connecting to a remote primary through an embedded replica. ValidateLocalOnlyOptions() throws InvalidOperationException during a plain Open() of a local or plain remote connection so these settings are not silently ignored.","triggerScenarios":"Calling Open()/OpenAsync() on a non-replica connection (no remote URL + Replica Path setup) while the connection string includes advanced replica options such as Partial Sync settings or Remote Encryption, detected by HasAdvancedReplicaOptions.","commonSituations":"Leaving replica-related connection-string options in place after removing 'Replica Path' or switching the data source back to a plain local file; configuration shared across local and replica deployments.","solutions":["Remove the advanced sync options (partial sync / Remote Encryption) from the connection string.","If you actually want a replica, configure the data source as a remote Turso URL with 'Replica Path' so it opens as an embedded replica.","Split local and replica connection strings into separate configuration entries instead of sharing one."],"exampleFix":"// before (local db with replica options)\n\"Data Source=local.db;Remote Encryption Cipher=aes-256-cbc;Remote Encryption Key=k\"\n// after\n\"Data Source=local.db\"\n// or make it a real replica:\n\"Data Source=https://mydb.turso.io;Replica Path=local.db;Remote Encryption Cipher=aes-256-cbc;Remote Encryption Key=k\"","handlingStrategy":"validation","validationCode":"var opts = new TursoConnectionOptions(cs);\nbool isReplica = !string.IsNullOrWhiteSpace(opts.ReplicaPath);\nif (!isReplica && (opts.SyncInterval > 0 || opts.HasAdvancedReplicaOptions))\n    throw new ArgumentException(\"Advanced sync options require an embedded replica connection string.\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Do not share one connection string between local and replica deployments.","Strip replica-only options when generating local connection strings."],"tags":["dotnet","embedded-replica","configuration","connection-string"],"backgroundTag":"replica-options-on-local-connection","analyzedSha":"6c7252267988c76e632af00a671e4b9788dfae13","analyzedAt":"2026-08-31T11:17:35.598Z","contentChangedAt":"2026-08-31T11:17:35.598Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}