tursodatabase/turso · error · NotSupportedException

Deleting a direct remote Turso database is not supported. Us

Error message

Deleting a direct remote Turso database is not supported. Use the Turso platform API to delete the remote database.

What it means

Guard inside TursoSqliteDatabaseCreator's delete path (ThrowIfDirectRemoteDelete, called from Delete/DeleteAsync). EF Core's Database.EnsureDeleted/Migrate pipeline calls this creator to drop the database; when the connection is a direct remote Turso database, dropping the whole database cannot be done via the client-side SQLite delete semantics, so the creator refuses instead of issuing an unsupported destructive operation against the remote platform. It fires whenever a delete of a database is requested while the connection string points directly at a remote Turso database.

Source

Thrown at bindings/dotnet/src/Turso.EntityFrameworkCore.Sqlite/Storage/Internal/TursoSqliteDatabaseCreator.cs:239

            relationalConnection,
            null,
            null,
            null,
            Dependencies.CommandLogger,
            CommandSource.Migrations);

    private static bool IsMemory(TursoSqliteConnectionStringBuilder options)
        => options.IsLocal
            && (options.DataSource.Equals(":memory:", StringComparison.OrdinalIgnoreCase)
                || options.Mode == TursoSqliteOpenMode.Memory)
           || options.IsReplica
            && options.ReplicaPath.Equals(":memory:", StringComparison.OrdinalIgnoreCase);

    private static void ThrowIfDirectRemoteDelete(TursoSqliteConnectionStringBuilder options)
    {
        if (options.IsDirectRemote)
        {
            throw new NotSupportedException(
                "Deleting a direct remote Turso database is not supported. "
                + "Use the Turso platform API to delete the remote database.");
        }
    }

    private static void DeleteDatabaseFiles(string path, bool includeReplicaSidecars)
    {
        if (string.IsNullOrWhiteSpace(path)
            || path.Equals(":memory:", StringComparison.OrdinalIgnoreCase))
        {
            return;
        }

        TursoSqliteConnection.ClearAllPools();
        var fullPath = Path.GetFullPath(path);
        File.Delete(fullPath);
        File.Delete(fullPath + "-journal");
        File.Delete(fullPath + "-wal");

View on GitHub (pinned to 492c4a71cd)

Solutions

  1. Delete the remote database through the Turso platform API (e.g. `turso db destroy`) instead of EnsureDeleted/Delete
  2. Point the connection string at a local database if client-side delete is required
  3. Recreate/reuse an existing remote database rather than deleting and recreating it
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at bindings/dotnet/src/Turso.EntityFrameworkCore.Sqlite/Storage/Internal/TursoSqliteDatabaseCreator.cs:239 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of tursodatabase/turso@492c4a71cd (2026-09-13). Data as JSON: /api/errors/f498d615c8cf7149. Report an issue: GitHub.