tursodatabase/turso · error · InvalidOperationException

TransactionCompleted

Error message

TransactionCompleted

What it means

Guard firing inside Commit (also reached from CommitAsync) when the transaction can no longer be committed — it was already committed or rolled back (ThrowIfCompleted) or was rolled back externally. The TransactionCompleted marker identifies end-of-life state on this SqliteTransaction; the faulting input is reusing a finished transaction.

Source

Thrown at bindings/dotnet/src/Turso.Data.Sqlite/SqliteTransaction.cs:60

    public override IsolationLevel IsolationLevel => _isolationLevel;

    public override bool SupportsSavepoints => true;

    protected override DbConnection? DbConnection => Connection;

    public new virtual SqliteConnection? Connection => _connection;

    internal bool IsCompleted => _completed;

    internal bool WasRolledBackExternally => _externalRollback;

    internal global::Turso.TursoTransaction? ManagedTransaction => _managedTransaction;

    public override void Commit()
    {
        ThrowIfCompleted();
        if (_externalRollback)
            throw new InvalidOperationException(Properties.Resources.TransactionCompleted);

        if (_managedTransaction is not null)
        {
            try
            {
                _managedTransaction.Commit();
            }
            catch (global::Turso.TursoRemoteSqlException ex) when (ex.IsStreamExpired)
            {
                Complete();
                throw SqliteCommand.ToSqliteException(ex);
            }
            catch (Turso.Raw.Public.TursoException ex)
            {
                if (_managedTransaction.IsCompleted)
                    Complete();
                throw SqliteCommand.ToSqliteException(ex);
            }

View on GitHub (pinned to 6c72522679)

Solutions

  1. Commit or roll back exactly once per transaction; track completion in your own code
  2. Check the transaction state (IsCompleted / WasRolledBackExternally where accessible) before calling Commit
  3. Discard the reference after Commit/Rollout and create a new transaction for subsequent work
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at bindings/dotnet/src/Turso.Data.Sqlite/SqliteTransaction.cs:60 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of tursodatabase/turso@6c72522679 (2026-09-06). Data as JSON: /api/errors/c849b58eef2d8dcb. Report an issue: GitHub.