I have a journal file with a transaction whose amounts are only computed based on a balance assignment.
Trying to insert an earlier transaction using hledger add fails because it checks the asserted balance using the same amounts as computed before, rather than the amounts that the balance assignment would imply after the new transaction being inserted.
$ hledger --version
hledger 1.52, linux-x86_64
$ cat hledger.journal
1970-01-02 transaction B
account1 = 1
account2
$ hledger add -f hledger.journal
Adding transactions to journal file hledger.journal
Any command line arguments will be used as defaults.
Use tab key to complete, readline keys to edit, enter to accept defaults.
An optional (CODE) may follow transaction dates.
An optional ; COMMENT may follow descriptions or amounts.
If you make a mistake, enter < at any prompt to go one step backward.
To end a transaction, enter . when prompted.
To quit, enter . at a date prompt or press control-d or control-c.
Date [2026-05-29]: 1970-01-01
Description: transaction A
Using this similar transaction for defaults:
1970-01-02 transaction B
account1 1 = 1
account2 -1
Account 1 [account1]: account1
Amount 1 [1]: 1
hledger.journal:2:15:
| 1970-01-02 transaction B
2 | account1 1 = 1
| ^^^
| account2 -1
Balance assertion failed in account1
In commodity "" at this point, excluding subaccounts, ignoring costs,
the asserted balance is: 1
but the calculated balance is: 2
(difference: -1)
To troubleshoot, check this account's running balance with assertions disabled, eg:
hledger reg -I 'account1$' cur:
Amount 1 [1]:
I tested this with version 1.52 on NixOS.
Note that this bug is similar to one that I've reported before: #2478
I have a journal file with a transaction whose amounts are only computed based on a balance assignment.
Trying to insert an earlier transaction using
hledger addfails because it checks the asserted balance using the same amounts as computed before, rather than the amounts that the balance assignment would imply after the new transaction being inserted.I tested this with version 1.52 on NixOS.
Note that this bug is similar to one that I've reported before: #2478