Under perpetual inventory, ERPNext keeps one rule: the value in your Stock Ledger equals the balance of your stock accounts, because every stock movement posts a matching General Ledger entry. When that breaks, and the Stock Balance report says one number while the GL says another, it is not random. It is a stray Journal Entry, a repost that hasn't finished, backdated entries into a closed period, or a warehouse mapped to the wrong account. This guide sizes your gap and traces it to its cause.
A Stock Ledger that disagrees with the General Ledger slowly wears down trust in an ERPNext system, because if stock value is wrong, so is COGS, and so is gross margin. I am Manoj, and I lead ERPNext and Frappe programmes at MithTech, a team of Frappe specialists in Bengaluru. Closing this gap is one of the most common accounting jobs our team takes on with inherited instances.
How is perpetual inventory supposed to behave?
With perpetual inventory enabled, ERPNext posts a General Ledger entry for every stock transaction: a receipt debits Stock-in-Hand, a delivery credits it and debits COGS, and so on. The official documentation states the rule plainly: the value as per the Stock Ledger should always equal the relevant account balance. So the Stock Balance report total and the Stock-in-Hand account in the GL are two views of the same number.
When they disagree, something posted to one side without the other. That is the diagnosis, and it narrows to a short list of causes.
How do you quantify the gap?
Before chasing anything, measure it. A ₹20 difference on ₹25 lakh of stock is rounding; a ₹2 lakh difference is a broken entry. Put in your two totals for a banded read.
Enter your Stock Ledger value and Stock-in-Hand GL balance to see the gap, its percentage of stock value, and whether it's rounding or a real break.
How do you trace it to the cause?
The Stock-vs-GL gap has a short list of causes, and they have very different fixes. Pick the one that fits what you know happened.
Select the most likely reason your Stock Ledger and General Ledger disagree to get its cause and the specific fix.
Is it a manual Journal Entry?
Most Stock-vs-GL breaks trace to one action: someone posted a Journal Entry straight to the Stock-in-Hand account, to "adjust" a balance, to book a write-off, or to correct something they didn't understand. Perpetual inventory keeps the account tied to the ledger by only ever posting from stock transactions. A manual JE moves the accounting side alone, and the two never realign on their own. The fix is to reverse the JE and make the adjustment through a Stock Entry or Stock Reconciliation instead, so both sides move together.
Is a repost still running?
If a backdated transaction queued a Repost Item Valuation that hasn't finished, the Stock Ledger values are mid-recalculation while the GL still shows the old numbers. This disagreement is expected until the repost completes, so before treating a gap as a break, confirm no repost is Queued, In Progress or Failed. If one is stuck, clear it first; our Repost Item Valuation guide covers it.
Did stock post into a closed period?
Stock posted into a period whose accounts were already closed leaves the ledger and the GL out of step for that window, because the GL repost may be skipped for the closed period, the pattern reported in discuss.frappe.io #134791. This is the one case where a journal adjustment may be the right answer, so decide it with your accountant: reopen the period and let the repost post, or book a reviewed adjustment in the current period and record why.
Is a warehouse mapped to the wrong account?
If a warehouse is mapped to the wrong account, or several warehouses share one Stock-in-Hand account that also holds unrelated balances, the account total won't line up with any single warehouse's ledger (#15148). Give stock warehouses their own accounts and compare like-for-like.
How do you close it, then keep it closed?
Quantify the mismatch with the variance report, realign via reposting, and prevent the drift from recurring.
Run the comparison reports
Stock > Reports > Stock and Account Value Comparison lists the vouchers whose stock value doesn't match their accounting entry: your shortlist, instead of a mystery total. Stock Ledger Variance shows Stock Ledger Entries whose quantity or value is inconsistent with the entries before them, which a repost usually fixes.
Rule out a pending repost
Check Repost Item Valuation for anything not Completed. If a repost is running or stuck, the gap may close once it finishes; clear stuck ones first and let the queue drain.
Find and reverse improper journal entries
Pull the General Ledger for the Stock-in-Hand account and look for Journal Entries; anything not coming from a stock transaction is suspect. Reverse them and re-do the adjustment through a Stock Entry or Stock Reconciliation.
Fix mappings and re-verify
Confirm each warehouse's account mapping is correct and unique where it should be. Then compare the Stock Balance total with the Stock-in-Hand GL balance again; they should now agree within rounding.
Should you fix it now, or monitor it?
| Trace and fix now | Monitor / accept |
|---|---|
| The gap is material and growing | The gap is a few rupees and stable (moving-average rounding) |
| A manual JE to a stock account is visible in the GL | A repost is mid-run and expected to realign it |
| Margins / COGS reports depend on the stock value | The difference rounds to noise on your P&L |
| You're heading into a statutory audit | You've just fixed it and are watching it hold |
At a glance
| Fix | ||
|---|---|---|
| Manual Journal Entry to a stock account | Journal Entries in the Stock-in-Hand GL | Reverse it; adjust through Stock Entry or Stock Reconciliation |
| Repost not finished | Repost Item Valuation not Completed | Clear stuck reposts and let the queue finish |
| Stock posted into a closed period | Gap limited to a closed period | Decide with your accountant: reopen, or a reviewed adjustment |
| Wrong warehouse-to-account mapping | Account total matches no warehouse | Give each stock warehouse the right account |
| Rounding | Tiny, stable difference | Leave it |
FAQ: what do people ask most?
+Why doesn't my ERPNext Stock Ledger match the General Ledger?
Under perpetual inventory the two should always agree, so a difference means something posted to one side without the other. The usual causes are a manual Journal Entry to a stock account, a valuation repost that hasn't finished, backdated entries into a closed period, or a wrong warehouse-to-account mapping. Run the Stock and Account Value Comparison report to find the specific vouchers.
+How do I fix a Stock-in-Hand account that doesn't match my stock value?
Size the gap, then run the Stock and Account Value Comparison report to list the mismatched vouchers. Rule out a pending repost, reverse any Journal Entry posted directly to the stock account, and correct warehouse-account mappings. Re-do adjustments through Stock Entry or Stock Reconciliation so both sides move together.
+Can I post a Journal Entry to fix a stock account balance?
Usually not; that is what causes most mismatches in the first place. A Journal Entry moves the General Ledger without a matching Stock Ledger movement, so the two permanently diverge. Adjust stock value through a Stock Reconciliation or Stock Entry, which post to both sides together. The exception is a gap stuck in a closed period, which your accountant should decide.
+Is a small difference between stock ledger and GL normal?
A tiny, stable difference under moving-average valuation can be genuine rounding on individual movements and is usually immaterial. A difference that grows over time is not rounding; it points to a manual journal entry, backdated entries, or a stuck repost, and should be traced.
+Does reposting fix a stock ledger vs GL mismatch?
It fixes the part caused by backdated entries: once every Repost Item Valuation is Completed, the stock-side values realign for open periods. It will not fix a mismatch caused by a manual Journal Entry or a wrong account mapping; those need reversing and correcting directly.
+Which report shows me the mismatched entries?
Stock and Account Value Comparison (Stock > Reports) lists the vouchers whose stock value doesn't match their accounting entry. Stock Ledger Variance shows Stock Ledger Entries that are inconsistent with the entries before them. With the Stock Balance total and the Stock-in-Hand balance in the GL, they turn a mystery total into a specific shortlist.
+Does this apply to ERPNext v14, v15 and v16?
Yes. Perpetual inventory posts to the GL on every movement, and the causes of a Stock-vs-GL gap are the same across v14, v15 and v16. Report names and a few UI paths differ slightly by release.
What is the bottom line?
Perpetual inventory only works if you respect its one rule: stock value changes through stock documents, never through direct journal entries to stock accounts. When the Stock Ledger and the General Ledger drift apart, quantify the gap, shortlist it with the variance report, and trace it to the stray entry or the pending repost behind it. Fix the cause, keep the rule, and the two numbers stay together, which is the only state in which your COGS and margins mean anything.
Comments & ratings
No comments yet. Start a new discussion.
Manoj · Published on 27 July 2026
Worked with us? Leave a Google review