{"record":{"id":"78eebd1a04aaefc5","repo":"tursodatabase/turso","slug":"partial-sync-cannot-be-combined-with-remote-encryp","errorCode":null,"errorMessage":"Partial sync cannot be combined with remote encryption.","messagePattern":"Partial sync cannot be combined with remote encryption\\.","errorType":"validation","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"bindings/dotnet/src/Turso.Data/TursoSyncDatabaseOptions.cs","lineNumber":183,"sourceCode":"        }\n\n        if (LongPollTimeout is { } timeout\n            && (timeout < TimeSpan.FromMilliseconds(1) || timeout.TotalMilliseconds > int.MaxValue))\n        {\n            throw new ArgumentOutOfRangeException(\n                nameof(LongPollTimeout),\n                timeout,\n                $\"Long-poll timeout must be between 1 and {int.MaxValue} milliseconds.\");\n        }\n\n        ValidateNativeSize(PushOperationsThreshold, nameof(PushOperationsThreshold));\n        ValidateNativeSize(PullBytesThreshold, nameof(PullBytesThreshold));\n        PartialSync?.Validate();\n\n        if (PartialSync is not null && !BootstrapIfEmpty)\n            throw new InvalidOperationException(\"Partial sync requires BootstrapIfEmpty=True.\");\n        if (PartialSync is not null && RemoteEncryption is not null)\n            throw new InvalidOperationException(\"Partial sync cannot be combined with remote encryption.\");\n        if (PartialSync?.Query is not null && PullBytesThreshold.HasValue)\n        {\n            throw new InvalidOperationException(\n                \"PullBytesThreshold cannot be combined with query partial bootstrap.\");\n        }\n        if (PartialSync is not null && OperatingSystem.IsWindows())\n        {\n            throw new PlatformNotSupportedException(\n                \"Partial sync on Windows requires native sparse-file hole detection that is not yet implemented.\");\n        }\n\n        RemoteEncryption?.Validate();\n    }\n\n    private static void ValidateNativeSize(long? value, string parameterName)\n    {\n        if (value is null)\n            return;","sourceCodeStart":165,"sourceCodeEnd":201,"githubUrl":"https://github.com/tursodatabase/turso/blob/c1e59287258d99b309e362a63f48822256e2f65f/bindings/dotnet/src/Turso.Data/TursoSyncDatabaseOptions.cs#L165-L201","documentation":"Validate rejects combining PartialSync with RemoteEncryption. The two features are not implemented together: partial sync's selective pull path does not support decrypting remotely encrypted data, so any configuration specifying both is refused with InvalidOperationException.","triggerScenarios":"Constructing TursoSyncDatabaseOptions with both PartialSync set (e.g. new TursoPartialSyncOptions { PrefixLength = N }) and RemoteEncryption = new TursoRemoteEncryptionOptions { Key = ..., Cipher = ... } — TursoSyncDatabaseOptions.cs:182-183.","commonSituations":"Adding encryption to an existing partial-sync replica setup after moving to an encrypted remote, combining sample configs from two different docs sections.","solutions":["Remove RemoteEncryption if you need partial sync.","Remove PartialSync and use full sync if you need remote encryption.","Check for newer library versions that may lift the restriction before working around it."],"exampleFix":"// before\nvar opts = new TursoSyncDatabaseOptions(path, uri)\n{\n    PartialSync = new() { PrefixLength = 100 },\n    RemoteEncryption = new() { Key = key, Cipher = TursoRemoteEncryptionCipher.Aes256Gcm }\n};\n// after\nvar opts = new TursoSyncDatabaseOptions(path, uri)\n{\n    RemoteEncryption = new() { Key = key, Cipher = TursoRemoteEncryptionCipher.Aes256Gcm }\n};","handlingStrategy":"validation","validationCode":"static void EnsureNotPartialPlusEncryption(object? partialSync, object? remoteEncryption)\n{\n    if (partialSync is not null && remoteEncryption is not null)\n        throw new InvalidOperationException(\"PartialSync and RemoteEncryption cannot be combined.\");\n}","typeGuard":"static bool SyncFeatureComboIsValid(object? partialSync, object? remoteEncryption) => partialSync is null || remoteEncryption is null;","tryCatchPattern":"try { var db = new TursoSyncDatabase(opts); }\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"remote encryption\"))\n{\n    // choose one feature and rebuild options\n}","preventionTips":["Decide upfront: either partial sync OR remote encryption, never both, in config templates.","Add an options-level guard in your configuration layer mirroring this library rule.","Re-check release notes for whether the restriction has been lifted before combining."],"tags":["dotnet","sync","partial-sync","encryption","invalid-configuration"],"backgroundTag":"invalid-sync-options","analyzedSha":"c1e59287258d99b309e362a63f48822256e2f65f","analyzedAt":"2026-08-31T11:17:35.598Z","contentChangedAt":"2026-08-31T11:17:35.598Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}