{"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":"validation","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"bindings/dotnet/src/Turso.Data/TursoConnection.cs","lineNumber":649,"sourceCode":"            if (!ReferenceEquals(sender, _automaticSyncCoordinator))\n                return;\n\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)","sourceCodeStart":631,"sourceCodeEnd":667,"githubUrl":"https://github.com/tursodatabase/turso/blob/6c7252267988c76e632af00a671e4b9788dfae13/bindings/dotnet/src/Turso.Data/TursoConnection.cs#L631-L667","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":"6c7252267988c76e632af00a671e4b9788dfae13","analyzedAt":"2026-08-31T11:17:35.598Z","contentChangedAt":"2026-08-31T11:17:35.598Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}