{"record":{"id":"f4f44e6258e9b119","repo":"tursodatabase/turso","slug":"tls-actual-conflicts-with-the-scheme-url-schem","errorCode":null,"errorMessage":"Tls={actual} conflicts with the {scheme} URL scheme.","messagePattern":"Tls=(.+?) conflicts with the (.+?) URL scheme\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"bindings/dotnet/src/Turso.Data/TursoConnectionOptions.cs","lineNumber":190,"sourceCode":"               && IsRemoteScheme(uri.Scheme);\n    }\n\n    private static bool IsRemoteScheme(string scheme)\n    {\n        return scheme.Equals(\"libsql\", StringComparison.OrdinalIgnoreCase)\n               || scheme.Equals(\"turso\", StringComparison.OrdinalIgnoreCase)\n               || scheme.Equals(\"http\", StringComparison.OrdinalIgnoreCase)\n               || scheme.Equals(\"https\", StringComparison.OrdinalIgnoreCase)\n               || scheme.Equals(\"ws\", StringComparison.OrdinalIgnoreCase)\n               || scheme.Equals(\"wss\", StringComparison.OrdinalIgnoreCase);\n    }\n\n    private string ValidateTls(string scheme, bool expectedTls, string? normalizedScheme = null)\n    {\n        if (Tls.HasValue && Tls.Value != expectedTls)\n        {\n            var actual = Tls.Value.ToString(CultureInfo.InvariantCulture);\n            throw new InvalidOperationException($\"Tls={actual} conflicts with the {scheme} URL scheme.\");\n        }\n\n        return normalizedScheme ?? scheme;\n    }\n}\n","sourceCodeStart":172,"sourceCodeEnd":196,"githubUrl":"https://github.com/tursodatabase/turso/blob/6c7252267988c76e632af00a671e4b9788dfae13/bindings/dotnet/src/Turso.Data/TursoConnectionOptions.cs#L172-L196","documentation":"ValidateTls() in TursoConnectionOptions enforces that an explicit 'Tls' connection-string value agrees with the URL scheme: https/wss imply TLS, http/ws imply plaintext. Setting Tls to the opposite of what the scheme already states is contradictory, so the provider refuses instead of guessing which one you meant. The libsql scheme itself never hits this because it resolves to http only when Tls=false.","triggerScenarios":"'Data Source=https://db.turso.io;Tls=false' (https with Tls disabled) or 'Data Source=http://host;Tls=true' (http with Tls required); likewise for ws/wss. Thrown when the connection is opened and GetRemoteUri() normalizes the scheme.","commonSituations":"Copy-pasting a Tls setting while switching the URL between http (local dev/emulator) and https (production); trying to disable TLS 'for testing' on an https endpoint; migrating from a client where Tls was a hint rather than a constraint.","solutions":["Remove the 'Tls' keyword entirely and let the URL scheme decide (https/wss = TLS on, http/ws = off).","If you truly need plaintext, change the URL scheme to http:// or ws:// to match 'Tls=false'.","If you need TLS, keep https:// or wss:// and drop 'Tls=false'."],"exampleFix":"// before\nData Source=https://my-db.turso.io;Tls=false\n\n// after (pick one)\nData Source=https://my-db.turso.io\nData Source=http://local-turso:8080;Tls=false","handlingStrategy":"validation","validationCode":"bool urlTls = dataSource.StartsWith(\"https://\") || dataSource.StartsWith(\"wss://\");\nif (options.Tls is bool tls && tls != urlTls)\n    throw new ConfigurationException(\"Remove the Tls keyword or align it with the URL scheme.\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Omit 'Tls' unless you specifically run plain http/ws; the scheme already encodes the choice.","Keep per-environment URLs and flags in one place so http-dev/https-prod cannot diverge from the flag."],"tags":["csharp","dotnet","connection-string","tls","https","config-conflict"],"backgroundTag":"tls-scheme-mismatch","analyzedSha":"6c7252267988c76e632af00a671e4b9788dfae13","analyzedAt":"2026-08-20T07:02:18.389Z","contentChangedAt":"2026-08-20T07:02:18.389Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}