tursodatabase/turso · error · NotSupportedException

Sync Interval requires embedded replica support, which is no

Error message

Sync Interval requires embedded replica support, which is not supported yet by the .NET provider.

What it means

OpenRemote's second guard: 'Sync Interval' configures periodic synchronization for embedded replicas, which the .NET provider does not implement, so any Sync Interval greater than zero on a remote connection string throws NotSupportedException at Open() — even when Replica Path is absent.

Source

Thrown at bindings/dotnet/src/Turso.Data/TursoConnection.cs:326

            return;

        try
        {
            remoteClient.CloseAsync(DefaultTimeout, CancellationToken.None).GetAwaiter().GetResult();
        }
        catch
        {
            InvalidateRemoteSession();
        }
    }

    private void OpenRemote()
    {
        if (_connectionOptions.IsReplica)
            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.");

        if (_connectionOptions.SyncInterval > 0)
            throw new NotSupportedException("Sync Interval requires embedded replica support, which is not supported yet by the .NET provider.");

        if (_connectionOptions.GetEncryptionCipher().HasValue || !string.IsNullOrWhiteSpace(_connectionOptions["Encryption Key"]))
            throw new InvalidOperationException("Encryption Cipher and Encryption Key are local database options and cannot be used with remote Turso URLs.");

        _remoteClient = new TursoRemoteClient(_connectionOptions.GetRemoteUri(), _connectionOptions.AuthToken);
    }

    private void ValidateLocalOnlyOptions()
    {
        if (!string.IsNullOrWhiteSpace(_connectionOptions.AuthToken))
            throw new InvalidOperationException("Auth Token requires a remote Turso URL Data Source.");
        if (!string.IsNullOrWhiteSpace(_connectionOptions.ReplicaPath))
            throw new InvalidOperationException("Replica Path requires a remote Turso URL Data Source.");
        if (_connectionOptions.SyncInterval > 0)
            throw new InvalidOperationException("Sync Interval requires a remote embedded replica connection.");
        if (_connectionOptions.Tls.HasValue)
            throw new InvalidOperationException("Tls requires a remote Turso URL Data Source.");
    }

View on GitHub (pinned to 244cde92a7)

Solutions

  1. Remove 'Sync Interval' from the connection string entirely
  2. Direct remote connections need no sync interval — every statement already executes on the server
  3. Note the option is currently unusable anywhere in .NET: local connections reject it too ('Sync Interval requires a remote embedded replica connection')

Example fix

// before
var cs = "Data Source=libsql://db.turso.io;Auth Token=...;Sync Interval=10";
using var conn = new TursoConnection(cs);
conn.Open(); // NotSupportedException

// after
var cs = "Data Source=libsql://db.turso.io;Auth Token=...";
using var conn = new TursoConnection(cs);
conn.Open();
Defensive patterns

Strategy: validation

Validate before calling

var opts = TursoConnectionOptions.Parse(cs);
if (opts.SyncInterval > 0)
    throw new InvalidOperationException(
        "Remove 'Sync Interval': embedded replicas are not supported by the .NET provider.");

Type guard

static bool HasNoReplicaOnlyOptions(string cs)
{
    var opts = TursoConnectionOptions.Parse(cs);
    return !opts.IsReplica && opts.SyncInterval <= 0;
}

Try / catch

try { conn.Open(); }
catch (NotSupportedException ex) when (ex.Message.Contains("Sync Interval requires embedded replica support"))
{
    // remove 'Sync Interval' from the connection string and retry
}

Prevention

When it happens

Trigger: Open() with 'Sync Interval=10' (or any positive value) on a remote Data Source; connection strings copied from SDKs that support periodic replica sync; config templates that always set a sync interval.

Common situations: Shared configuration across services written in different languages; tuning guides written for other Turso bindings; defaults injected by a platform's Turso integration.

Related errors


AI-assisted analysis of tursodatabase/turso@244cde92a7 (2026-08-20). Data as JSON: /api/errors/5012e9861d57dd71. Report an issue: GitHub.