SQLite Forum

cannot start a transaction within a transaction using sqlite shell
Login
This is because of a failure to comprehend what is happening, and a failure to check the return code of each statement within a batch.

You are sending "commands" of the form:  `BEGIN; <do something>; COMMIT;`

This ENTIRE bufferload consisting of THREE STATEMENTS is sent to the CLI for execution.  However, the execution had an ABORT at the second statement in the batch; thus, aborting the batch.  The `COMMIT;` statement was never executed.

Thereafter, for each subsequent duplicate bufferload of three statements batched together, the first statement in the batch, `BEGIN;`, is executed when a transaction is in progress.  An error message that you cannot start a transaction within a transaction is issued and the entire batch is ABORTED -- the remaining three statements in the batch are not executed.

Lather, Rinse, Repeat.

As for the difference with DELETE journal vs WAL probably is the result of an attempt to upgrade a stale snapshot.