{"record":{"id":"1e31fd794b449bb6","repo":"tursodatabase/turso","slug":"replica-path-requires-a-remote-turso-url-data-sour","errorCode":null,"errorMessage":"Replica Path requires a remote Turso URL Data Source.","messagePattern":"Replica Path requires a remote Turso URL Data Source\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"bindings/dotnet/src/Turso.Data/TursoConnection.cs","lineNumber":339,"sourceCode":"    {\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.\");\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","sourceCodeStart":321,"sourceCodeEnd":357,"githubUrl":"https://github.com/tursodatabase/turso/blob/244cde92a7df7f9b8b8b7a4075c35a12977e303e/bindings/dotnet/src/Turso.Data/TursoConnection.cs#L321-L357","documentation":"ValidateLocalOnlyOptions rejects 'Replica Path' on local connections: a replica path names the local file where an embedded replica of a remote database lives, so it only pairs with a remote Data Source. With a file path Data Source, Open() throws 'Replica Path requires a remote Turso URL Data Source.'","triggerScenarios":"Open() with 'Data Source=app.db;Replica Path=replica.db' — two file paths, which is contradictory; leftover Replica Path keyword after changing the Data Source from a URL to a local file; config shared from replica-enabled environments.","commonSituations":"Switching an app between remote and local modes by editing only the Data Source; config copied from SDKs that support embedded replicas; template connection strings that include every option.","solutions":["Remove 'Replica Path' for local databases","Or pair it with a remote Data Source — but note the .NET provider rejects replica connections entirely with NotSupportedException","When switching Data Source modes, clean all mode-specific keywords, not just the Data Source itself"],"exampleFix":"// before\nvar cs = \"Data Source=app.db;Replica Path=replica.db\"; // local + Replica Path\n\n// after\nvar cs = \"Data Source=app.db\";","handlingStrategy":"validation","validationCode":"var opts = TursoConnectionOptions.Parse(cs);\nif (!opts.IsRemote && !string.IsNullOrWhiteSpace(opts.ReplicaPath))\n    throw new InvalidOperationException(\n        \"Remove 'Replica Path' or switch Data Source to a remote URL.\");","typeGuard":"static bool ReplicaPathMatchesMode(string cs)\n{\n    var opts = TursoConnectionOptions.Parse(cs);\n    return opts.IsRemote || string.IsNullOrWhiteSpace(opts.ReplicaPath);\n}","tryCatchPattern":"try { conn.Open(); }\ncatch (InvalidOperationException ex) when (ex.Message == \"Replica Path requires a remote Turso URL Data Source.\")\n{\n    // remove 'Replica Path' for local files; note replicas are unsupported in .NET even remotely\n}","preventionTips":["When switching Data Source between URL and file, clean every mode-specific keyword","Remember remote + Replica Path is also rejected (NotSupportedException) in this provider","Validate the final connection string once at startup"],"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"}