{"record":{"id":"ef6755c30b958f25","repo":"tursodatabase/turso","slug":"embedded-replica-connections-are-not-supported-yet","errorCode":null,"errorMessage":"Embedded replica connections are not supported yet by the .NET provider. Use a remote URL without Replica Path for direct remote execution.","messagePattern":"Embedded replica connections are not supported yet by the \\.NET provider\\. Use a remote URL without Replica Path for direct remote execution\\.","errorType":"exception","errorClass":"NotSupportedException","httpStatus":null,"severity":"error","filePath":"bindings/dotnet/src/Turso.Data/TursoConnection.cs","lineNumber":323,"sourceCode":"    internal void CloseRemoteSessionIfStateless()\n    {\n        if (_connectionOptions.ReadYourWrites || _remoteClient is not { HasOpenSession: true } remoteClient)\n            return;\n\n        try\n        {\n            remoteClient.CloseAsync(DefaultTimeout, CancellationToken.None).GetAwaiter().GetResult();\n        }\n        catch\n        {\n            InvalidateRemoteSession();\n        }\n    }\n\n    private void OpenRemote()\n    {\n        if (_connectionOptions.IsReplica)\n            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.\");","sourceCodeStart":305,"sourceCodeEnd":341,"githubUrl":"https://github.com/tursodatabase/turso/blob/244cde92a7df7f9b8b8b7a4075c35a12977e303e/bindings/dotnet/src/Turso.Data/TursoConnection.cs#L305-L341","documentation":"TursoConnection.Open() routes remote Data Sources to OpenRemote(), whose first guard rejects embedded-replica configuration with NotSupportedException because the .NET provider has not implemented replicas. IsReplica is true whenever the Data Source scheme is remote (libsql/http/https/ws/wss) and 'Replica Path' is non-empty — merely containing that keyword on a remote URL triggers the throw at Open().","triggerScenarios":"Open() with 'Data Source=libsql://db.turso.io;Auth Token=...;Replica Path=local.db'; copying a replica connection string from Turso's Rust/Python/JS examples into a .NET app; environment config that adds Replica Path for offline scenarios.","commonSituations":"Polyglot repositories sharing one config file across languages; following Turso docs written for other bindings; app templates that include replica options by default; migrating from a wrapper that supported replicas.","solutions":["Remove 'Replica Path' from the connection string and use direct remote execution against the Turso URL","If a local file database is wanted, use a plain file path Data Source with no remote-only keywords (Auth Token, Replica Path, Sync Interval, Tls)","Track provider releases and move to replicas only once supported"],"exampleFix":"// before\nvar cs = \"Data Source=libsql://my-db.turso.io;Auth Token=...;Replica Path=local.db\";\nusing var conn = new TursoConnection(cs);\nconn.Open(); // NotSupportedException\n\n// after\nvar cs = \"Data Source=libsql://my-db.turso.io;Auth Token=...\";\nusing var conn = new TursoConnection(cs);\nconn.Open();","handlingStrategy":"validation","validationCode":"var opts = TursoConnectionOptions.Parse(cs);\nif (opts.IsReplica)\n    throw new InvalidOperationException(\n        \"Remove 'Replica Path': the .NET Turso provider only supports direct remote connections.\");\nusing var conn = new TursoConnection(cs);\nconn.Open();","typeGuard":"static bool IsSupportedConnectionString(string cs)\n{\n    var opts = TursoConnectionOptions.Parse(cs);\n    return !opts.IsReplica && opts.SyncInterval <= 0;\n}","tryCatchPattern":"try { conn.Open(); }\ncatch (NotSupportedException ex) when (ex.Message.Contains(\"Embedded replica connections are not supported\"))\n{\n    // strip 'Replica Path' from config and retry with a direct remote URL\n}","preventionTips":["Keep replica keywords out of .NET connection strings","Validate the connection string once at startup, not per Open","Keep language-specific connection strings in separate config entries"],"tags":["csharp","dotnet","turso","embedded-replica","connection-string","not-supported"],"backgroundTag":"embedded-replica-not-supported","analyzedSha":"244cde92a7df7f9b8b8b7a4075c35a12977e303e","analyzedAt":"2026-08-20T07:02:18.389Z","schemaVersion":2},"datasetVersion":"2026-08-21T13:17:26.733Z"}