{"record":{"id":"26c5d6fbfc35b97a","repo":"tursodatabase/turso","slug":"sync-interval-requires-a-remote-embedded-replica-c","errorCode":null,"errorMessage":"Sync Interval requires a remote embedded replica connection.","messagePattern":"Sync Interval requires a remote embedded replica connection\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"bindings/dotnet/src/Turso.Data/TursoConnection.cs","lineNumber":341,"sourceCode":"            throw new NotSupportedException(\"Embedded replica connections are not supported yet by the .NET provider. Use a remote URL without Replica Path for direct remote execution.\");\n\n        if (_connectionOptions.SyncInterval > 0)\n            throw new NotSupportedException(\"Sync Interval requires embedded replica support, which is not supported yet by the .NET provider.\");\n\n        if (_connectionOptions.GetEncryptionCipher().HasValue || !string.IsNullOrWhiteSpace(_connectionOptions[\"Encryption Key\"]))\n            throw new InvalidOperationException(\"Encryption Cipher and Encryption Key are local database options and cannot be used with remote Turso URLs.\");\n\n        _remoteClient = new TursoRemoteClient(_connectionOptions.GetRemoteUri(), _connectionOptions.AuthToken);\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.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                remoteClient\n                    .ExecuteAsync(\"ROLLBACK\", new TursoParameterCollection(), wantRows: false, DefaultTimeout, closeAfter: true, CancellationToken.None)\n                    .GetAwaiter()","sourceCodeStart":323,"sourceCodeEnd":359,"githubUrl":"https://github.com/tursodatabase/turso/blob/244cde92a7df7f9b8b8b7a4075c35a12977e303e/bindings/dotnet/src/Turso.Data/TursoConnection.cs#L323-L359","documentation":"ValidateLocalOnlyOptions rejects 'Sync Interval' on local connections with 'Sync Interval requires a remote embedded replica connection.': the option schedules periodic pulls for embedded replicas, which by definition need a remote primary. A purely local file database has nothing to sync with, so Open() fails fast rather than ignoring the option.","triggerScenarios":"Open() with 'Data Source=app.db;Sync Interval=10'; a sync interval left in the string after switching from a replica URL to a local file; shared config across projects where some instances are remote.","commonSituations":"Local development against a config written for embedded replicas; option defaults injected by tooling; misunderstanding that the option only tunes replica sync, not general refresh.","solutions":["Remove 'Sync Interval' for local file databases","Note the option is currently unusable in .NET altogether: remote connections throw NotSupportedException because embedded replicas are unsupported","Move mode-specific keywords out of base config into per-mode config files"],"exampleFix":"// before\nvar cs = \"Data Source=app.db;Sync Interval=10\";\n\n// after\nvar cs = \"Data Source=app.db\";","handlingStrategy":"validation","validationCode":"var opts = TursoConnectionOptions.Parse(cs);\nif (!opts.IsRemote && opts.SyncInterval > 0)\n    throw new InvalidOperationException(\n        \"Remove 'Sync Interval': it requires a remote embedded replica connection.\");","typeGuard":"static bool SyncIntervalMatchesMode(string cs)\n{\n    var opts = TursoConnectionOptions.Parse(cs);\n    return opts.IsRemote || opts.SyncInterval <= 0;\n}","tryCatchPattern":"try { conn.Open(); }\ncatch (InvalidOperationException ex) when (ex.Message == \"Sync Interval requires a remote embedded replica connection.\")\n{\n    // remove 'Sync Interval' from the local connection string and retry\n}","preventionTips":["Sync Interval is a replica-only knob; local files have nothing to sync","Remove it when switching configs from remote to local mode","The option is currently unusable in the .NET provider in any mode"],"tags":["csharp","dotnet","turso","connection-string","embedded-replica","configuration"],"backgroundTag":"invalid-connection-string-option","analyzedSha":"244cde92a7df7f9b8b8b7a4075c35a12977e303e","analyzedAt":"2026-08-20T07:02:18.389Z","schemaVersion":2},"datasetVersion":"2026-08-21T13:17:26.733Z"}