{"record":{"id":"88f074b614abbe99","repo":"tursodatabase/turso","slug":"remote-turso-urls-must-include-a-host","errorCode":null,"errorMessage":"Remote Turso URLs must include a host.","messagePattern":"Remote Turso URLs must include a host\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"bindings/dotnet/src/Turso.Data/TursoConnectionOptions.cs","lineNumber":138,"sourceCode":"\n        return new TursoRemoteEncryptionOptions\n        {\n            Cipher = TursoRemoteEncryptionOptions.ParseCipher(cipher),\n            Key = key,\n        };\n    }\n\n    public Uri GetRemoteUri()\n    {\n        if (!Uri.TryCreate(DataSource, UriKind.Absolute, out var uri) || !IsRemoteScheme(uri.Scheme))\n            throw new InvalidOperationException($\"Data Source is not a remote Turso URL: {DataSource}\");\n\n        if (!string.IsNullOrEmpty(uri.Query) || !string.IsNullOrEmpty(uri.Fragment))\n            throw new InvalidOperationException(\"Remote Turso URLs must not include query strings or fragments.\");\n        if (!string.IsNullOrEmpty(uri.UserInfo))\n            throw new InvalidOperationException(\"Remote Turso URLs must not include embedded user information; use Auth Token instead.\");\n        if (string.IsNullOrEmpty(uri.Host))\n            throw new InvalidOperationException(\"Remote Turso URLs must include a host.\");\n\n        var scheme = uri.Scheme.ToLowerInvariant() switch\n        {\n            \"libsql\" => Tls == false ? \"http\" : \"https\",\n            \"turso\" => ValidateTls(uri.Scheme, expectedTls: true, normalizedScheme: \"https\"),\n            \"http\" => ValidateTls(uri.Scheme, expectedTls: false),\n            \"https\" => ValidateTls(uri.Scheme, expectedTls: true),\n            \"ws\" => ValidateTls(uri.Scheme, expectedTls: false, normalizedScheme: \"http\"),\n            \"wss\" => ValidateTls(uri.Scheme, expectedTls: true, normalizedScheme: \"https\"),\n            _ => throw new InvalidOperationException($\"Unsupported remote Turso URL scheme: {uri.Scheme}\")\n        };\n\n        var builder = new UriBuilder(uri)\n        {\n            Scheme = scheme,\n            Port = uri.IsDefaultPort ? -1 : uri.Port,\n            UserName = string.Empty,\n            Password = string.Empty,","sourceCodeStart":120,"sourceCodeEnd":156,"githubUrl":"https://github.com/tursodatabase/turso/blob/6c7252267988c76e632af00a671e4b9788dfae13/bindings/dotnet/src/Turso.Data/TursoConnectionOptions.cs#L120-L156","documentation":"GetRemoteUri() requires the remote URL to have a host component; this exception means the URI parsed successfully with an accepted scheme but Uri.Host is empty. It typically happens when the '//' authority separator is missing, so .NET parses the URL mailto-style (scheme:value) with no host.","triggerScenarios":"Data Source values like 'libsql:my-db' (no '//' — parsed as scheme plus opaque path), 'libsql://' with nothing after, or 'https:///path' — all produce an absolute URI with an accepted scheme but an empty Host, and Open()/GetRemoteUri() then throws.","commonSituations":"Hand-typing the URL and omitting '://'; string concatenation that drops the slashes ('libsql:' + host); config templating that leaves the host placeholder empty in some environments.","solutions":["Write the URL with the authority separator and a real host: 'libsql://my-db-my-org.turso.io'.","Check that config interpolation actually fills in the host value in every environment.","If you intended a local file, use a plain path without a remote scheme."],"exampleFix":"// before\nData Source=libsql:my-db\n\n// after\nData Source=libsql://my-db-my-org.turso.io","handlingStrategy":"validation","validationCode":"if (!Uri.TryCreate(dataSource, UriKind.Absolute, out var uri) || string.IsNullOrEmpty(uri.Host))\n    throw new ConfigurationException($\"Data Source needs scheme://host, got: {dataSource}\");","typeGuard":"static bool HasHost(string dataSource) =>\n    Uri.TryCreate(dataSource, UriKind.Absolute, out var uri) && !string.IsNullOrEmpty(uri.Host);","tryCatchPattern":null,"preventionTips":["Validate the URL at startup, especially when it is built by string interpolation.","Prefer full URLs from the Turso dashboard over hand-typed ones."],"tags":["csharp","dotnet","connection-string","url-validation","hostname"],"backgroundTag":"invalid-connection-url","analyzedSha":"6c7252267988c76e632af00a671e4b9788dfae13","analyzedAt":"2026-08-20T07:02:18.389Z","contentChangedAt":"2026-08-20T07:02:18.389Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}