Skip to content

1.43-1.43.1: adding transactions before a balance assignment no longer works, requires -I #2406

@wgslr

Description

@wgslr

My workflow for reconciling hledger journal with my bank accounts is to add a transaction for today with balance assignments reflecting the current balance of the accounts. Then, I add missed transactions from the past until hledger print -x -ptoday shows all the balance assignment postings to be 0. After upgrading to 1.43, hlegder add prevents me from adding those older transactions unless I use the -I option. It seems that the change "whenever you enter an amount, [hledger add] now checks the journal's balance assertions" incorrectly affects balance assignments as well. Not the first time it turns out I seem to be the only person using balance assignments in hledger 😂

Example

My journal file:

2025-06-01 Transaction 1
    account  100$
    equity   -100$

2025-06-10 Assert balance
    account   ==* 200$
    equity:reconciliation

Failing add, note the date older than the balance assignment:

$ hledger add -f journal.hledger
Date [2025-06-10]: 6-8
Description: Missed transaction
Using this similar transaction for defaults:
2025-06-01 Transaction 1
    account            100$
    equity            -100$

Account 1 [account]:
Amount  1 [100$]: 100$
/home/wojciech/hledger-repro/journal.hledger:6:15:
  | 2025-06-10 Assert balance
6 |     account                         100$ ==* 200$
  |                                          ^^^^^^^^
  |     equity:reconciliation           -100$

Balance assertion failed in account
Across all commodities at this point, including subaccounts, ignoring costs,
the asserted balance is:        200$
but the calculated balance is:  300$
(difference: -100$)
To troubleshoot, check this account's running balance with assertions disabled, eg:
hledger reg -I 'account'

Note as well that this fails even though I'm adding exactly $100, which is the amount missing in the assignment on 2025-06-10. I believe hledger add should succeed in this case regardless of the amount in the added posting.

Version

Running in wsl

$ hledger --version
hledger 1.43.1, linux-x86_64

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-BUGSomething wrong, confusing or sub-standard in the software, docs, or user experience.addaffects3-fewAffects just a few users.annoyance2-minorMinor to moderate usability/doc bug, reasonably easy to avoid or tolerate.bountyThar's some kind o' loot on offer..docsDocumentation-related.regressionA backwards step, indicating a weakness in our QA. We don't like these.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions