-
-
Notifications
You must be signed in to change notification settings - Fork 341
Open
Labels
A-BUGSomething wrong, confusing or sub-standard in the software, docs, or user experience.Something wrong, confusing or sub-standard in the software, docs, or user experience.addaffects4-manyAffects potentially a significant number of users.Affects potentially a significant number of users.annoyance4-majorMajor usability/doc bug, or any regression or crash.Major usability/doc bug, or any regression or crash.regressionA backwards step, indicating a weakness in our QA. We don't like these.A backwards step, indicating a weakness in our QA. We don't like these.
Description
Consider the following journal file whose balance assertions all hold:
$ cat hledger.journal
2000-01-02 second transaction
account1 $1 ==* $1 ; date:1/1
account2 $-1
2000-01-01 first transaction
account1 $-1
account3 $1
Note that $1 is credited to account1 on 1/1 before $1 is debited from account1 on 1/1, because of the date:1/1
comment.
However, hledger add
seems to not take that comment into consideration, thus computing the balance in the wrong order. At least that's my assumption.
$ hledger check -f hledger.journal
$ 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 [2025-10-10]:
Description: test
Using this similar transaction for defaults:
2000-01-01 first transaction
account1 $-1
account3 $1
Account 1 [account1]: account4
Amount 1 [$-1]: $1
hledger.journal:2:18:
| 2000-01-02 second transaction
2 | account1 $1 ==* $1 ; date:1/1
| ^^^^^^^^^^^^^^^^^^
| account2 $-1
Balance assertion failed in account1
Across all commodities at this point, including subaccounts, ignoring costs,
the asserted balance is: $1
but the calculated balance is: $0
(difference: $1)
To troubleshoot, check this account's running balance with assertions disabled, eg:
hledger reg -I 'account1'
Amount 1 [$-1]:
I tested this with hledger version 1.50.2 on NixOS:
$ hledger setup
Checking your hledger setup..
Legend: good, neutral, unknown, warning
hledger
* is a released version ? yes hledger 1.50.2, linux-x86_64
* is up to date ? yes 1.50.2 installed, latest is 1.50.2
* is a native binary for this machine ? yes x86_64
* is installed in PATH (this version) ? no
A different hledger version was found in PATH: hledger 1.43.2, linux-x86_64
at: /etc/profiles/per-user/user/bin/hledger
Some of this info may not apply to that hledger version. Continuing anyway..
* has a system text encoding configured ? yes UTF-8, data files must use this encoding
* has a user config file ? no
* has a local config file ? no
This issue is somewhat similar to #2406 but doesn't rely on adding transactions before a balance assertion.
I know that it also occurs with version 1.43.2 but doesn't occur with version 1.40.
Metadata
Metadata
Assignees
Labels
A-BUGSomething wrong, confusing or sub-standard in the software, docs, or user experience.Something wrong, confusing or sub-standard in the software, docs, or user experience.addaffects4-manyAffects potentially a significant number of users.Affects potentially a significant number of users.annoyance4-majorMajor usability/doc bug, or any regression or crash.Major usability/doc bug, or any regression or crash.regressionA backwards step, indicating a weakness in our QA. We don't like these.A backwards step, indicating a weakness in our QA. We don't like these.