DataError: Out of range value for column 'total_debit' when saving large Journal Entry totals

Hi everyone,

I’m getting a database error whenever I try to create a Journal Entry with a very large amount. Even a minimal entry like the example below fails:

  • Account A — Debit: 42,640,545,170,577
  • Account B — Credit: 42,640,545,170,577
    Error message:
    pymysql.err.DataError: (1264, “Out of range value for column ‘total_debit’ at row 1”)

This happens both via UI (new Journal Entry) and via Data Import. Smaller amounts save fine

  • ERPNext / Frappe versions: 15

Questions:

What is the expected numeric precision/scale for total_debit / total_credit in ERPNext?

Is there a known limit for Journal Entry totals in MariaDB/MySQL that ERPNext enforces?

Any configuration I should check (System Settings → Currency Precision, Global Defaults, or DocType field precision)?

Update / Solution

I faced this issue when saving very large Journal Entry amounts. The problem is that ERPNext’s default DB schema uses a limited precision for numeric fields like total_debit / total_credit, so values above a certain threshold will throw the “Out of range value” error from MariaDB/MySQL.

Since nobody had answered, I wrote a patch that expands the currency precision in ERPNext.
You can find it here:
:point_right: ERPNext_Extension – expand_currency_precision

After applying this patch, I was able to save Journal Entries with very large amounts without error.

Hopefully this helps anyone else who runs into the same limitation.

1 Like