Why does the balance assertion fail if the math is right?

45 views
Skip to first unread message

Paulo Phagula

unread,
Jul 26, 2019, 1:21:04 PM7/26/19
to Ledger
Hi,

I noticed that on my bigger ledger file some balance assertions fail, even though the math is right, like in the reduced example below:

2019-01-01 Opening Balances
   Assets:Banks:MPESA850 MT5735.00
   Equity:Opening Balances

2019-03-20 * Bananas
   Assets:Banks:MPESA850 MT-10.00
   Expenses:Banks:Fees MT10.00
   Expenses:Food:Bananas MT1500.00
   Assets:Banks:MPESA850 MT-1500.00 = MT4225.00


While parsing file "/home/phagulap/Dropbox/financials/minimal.ledger", line 9: While parsing posting: Assets:Banks:MPESA850 MT-1500.00 = MT4225.00 ^^^^^^^^^ Error: Balance assertion off by MT-10.00 (expected to see MT4235.00) [1] 23522 exit 1 ledger -f minimal.ledger

Does this mean I have to post the fees independently for ledger to understand?

Cheers

Paulo Phagula

unread,
Jul 26, 2019, 1:23:19 PM7/26/19
to Ledger
Attaching screenshot
Screenshot from 2019-07-26 19-17-23.png

Robin H. Johnson

unread,
Jul 31, 2019, 2:43:08 PM7/31/19
to ledge...@googlegroups.com
On Fri, Jul 26, 2019 at 10:21:04AM -0700, Paulo Phagula wrote:
> While parsing file "/home/phagulap/Dropbox/financials/minimal.ledger", line
> 9: While parsing posting: Assets:Banks:MPESA850 MT-1500.00 = MT4225.00
> ^^^^^^^^^ Error: Balance assertion off by MT-10.00 (expected to see
> MT4235.00) [1] 23522 exit 1 ledger -f minimal.ledger
>
> Does this mean I have to post the fees independently for ledger to
> understand?
Exactly what version of Ledger are you using? Your reduced example works
fine on Ledger 3.1.2.

$ ledger -f minimal.ledger bal
MT4225.00 Assets:Banks:MPESA850
MT-5735.00 Equity:Opening Balances
MT1510.00 Expenses
MT10.00 Banks:Fees
MT1500.00 Food:Bananas
--------------------
0

--
Robin Hugh Johnson
Gentoo Linux: Dev, Infra Lead, Foundation Treasurer
E-Mail : rob...@gentoo.org
GnuPG FP : 11ACBA4F 4778E3F6 E4EDF38E B27B944E 34884E85
GnuPG FP : 7D0B3CEB E9B85B1F 825BCECF EE05E6F6 A48F6136
signature.asc

Paulo Phagula

unread,
Aug 1, 2019, 6:10:59 AM8/1/19
to Ledger
Hi,

I'm using Ledger 3.1.2-20160801 in Ubuntu 18.04. Its on the screenshot.

Cheers

Colin Dean

unread,
Aug 1, 2019, 3:11:18 PM8/1/19
to Ledger
I'm using Ledger 3.1.3-20190331 and your example works.

There were some changes to balance assertions that make them work better in subsequent versions.  It would likely be worth your time to use a more recent version: when I went from 3.1.2 to 3.1.3, my older tx records' BAs began to fail. I could trust that they _were_ working, so I could remove them or use the flag that turns them off (--permissive, iirc) when interacting with those records' files. I upgraded at a year boundary and simply sealed off my old records with an opening balances transaction.

Paulo Phagula

unread,
Aug 2, 2019, 6:13:22 AM8/2/19
to Ledger
Hi,

Indeed it is a version thing. I just compiled the latest and worked fine!

Thanks
Reply all
Reply to author
Forward
0 new messages