hledger icon indicating copy to clipboard operation
hledger copied to clipboard

hledger can't parse two sets of identical equity:conversion postings

Open the-solipsist opened this issue 6 months ago • 3 comments

❯ hledger --version hledger 1.43.2, linux-x86_64

Parsing

If an "Equity:Conversion" transaction has two sets of identical entries, hledger fails to parse them. If they are not identical, then hledger works.

This transaction can be parsed by hledger:

2025-08-08 Grab | Taxi
    Expenses:Transport:Passenger:Road:Taxi    THB 138.00 @@ ₹373.135
    equity:conversion:THB-₹:THB                          THB -138.00
    equity:conversion:THB-₹:₹                               ₹373.135
    Assets:Receivable:People:XXXXXX-XXXXXX    THB 137.00 @@ ₹373.135
    equity:conversion:THB-₹:THB                          THB -137.00
    equity:conversion:THB-₹:₹                               ₹373.135
    Liabilities:Credit-Card:IDFC                            ₹-746.27

But this transaction cannot:

2025-08-08 Grab | Taxi
    Expenses:Transport:Passenger:Road:Taxi    THB 137.00 @@ ₹373.135
    equity:conversion:THB-₹:THB                          THB -137.00
    equity:conversion:THB-₹:₹                               ₹373.135
    Assets:Receivable:People:XXXXXX-XXXXXX    THB 137.00 @@ ₹373.135
    equity:conversion:THB-₹:THB                          THB -137.00
    equity:conversion:THB-₹:₹                               ₹373.135
    Liabilities:Credit-Card:IDFC                            ₹-746.27

But the latter can be generated by hledger print --infer-equity if this is the transaction:

2025-08-08 Grab | Taxi
    Expenses:Transport:Passenger:Road:Taxi    THB 137.00 @@ ₹373.135
    Assets:Receivable:People:XXXXXX-XXXXXX    THB 137.00 @@ ₹373.135
    Liabilities:Credit-Card:IDFC                            ₹-746.27

Infer-Costs

Similarly, hledger reg --infer-cost -B does not work for this transaction:

2025-08-08 Grab | Taxi
    Expenses:Transport:Passenger:Road:Taxi    THB 137.00
    equity:conversion:THB-₹:THB              THB -137.00
    equity:conversion:THB-₹:₹                   ₹373.135
    Assets:Receivable:People:XXXXXX-XXXXXX    THB 137.00
    equity:conversion:THB-₹:THB              THB -137.00
    equity:conversion:THB-₹:₹                   ₹373.135
    Liabilities:Credit-Card:IDFC                ₹-746.27

But hledger reg --infer-cost -B works for this:

2025-08-08 Grab | Taxi
    Expenses:Transport:Passenger:Road:Taxi    THB 138.00
    equity:conversion:THB-₹:THB              THB -138.00
    equity:conversion:THB-₹:₹                   ₹373.135
    Assets:Receivable:People:XXXXXX-XXXXXX    THB 137.00
    equity:conversion:THB-₹:THB              THB -137.00
    equity:conversion:THB-₹:₹                   ₹373.135
    Liabilities:Credit-Card:IDFC                ₹-746.27

I believe this ought to be counted as a bug.

the-solipsist avatar Aug 14 '25 20:08 the-solipsist

Thanks for this report @the-solipsist. https://hledger.org/1.50/hledger.html#combining-costs-and-equity-conversion-postings and the following section try to set appropriate expectations for this feature, but I think that doc could be improved to cover your example, so that's a bug at least.

simonmichael avatar Oct 02 '25 04:10 simonmichael

And I agree that it would be nice if this feature could be made more robust, handling more kinds of entries.

simonmichael avatar Oct 02 '25 04:10 simonmichael

I think the fact that hledger cannot parse an entry that is generated by hledger (via hledger print --infer-equity) is an issue that goes beyond the documentation. Given that this feature is @Xitian9's child, I wonder if he has any thoughts about it.

the-solipsist avatar Oct 02 '25 06:10 the-solipsist