You try to submit a Delivery Note, a Sales Invoice, or a POS closing entry, and ERPNext blocks it: "Negative quantity is not allowed", or "N units of Item needed in Warehouse to complete this transaction". The reflex is to tick Allow Negative Stock and move on — which usually trades a visible error for an invisible valuation problem. This guide shows what actually causes the error, whether allowing negative stock is right for you, and how to fix it properly by posting sequence or reconciliation.
Getting this error after a backdated entry?
If the negative stock appeared after you inserted or cancelled a transaction in the past, the underlying recomputation is a Repost Item Valuation — and if that's stuck, the balance stays wrong. See ERPNext Repost Item Valuation stuck: causes & fix alongside this post.
Nine times out of ten, "stock cannot be negative" is not a stock problem — it's a posting-time-order problem. I am Manoj, ERPNext and Frappe implementation lead at Mith Tech in Bengaluru; we clear these on client instances weekly, and the fix is almost never "allow negative stock".
What the error actually means
ERPNext keeps a Stock Ledger Entry for every movement, and it checks the running balance at the exact posting date-time of each entry. When you submit an outward document — a Delivery Note, a Sales Invoice with Update Stock, a manufacturing consumption Stock Entry — it asks: at this posting instant, is there enough on hand? If not, it blocks the submit, because with Allow Negative Stock disabled (the default), the ledger is not permitted to go below zero at any point.
That is why the error can feel illogical: you know the goods arrived, you can see the Purchase Receipt, and the day's totals net out fine. But if the receipt's posting time is after the sale's, then at the sale's instant the warehouse genuinely showed a shortfall.
Which situation are you in?
Pick the cause that matches your case — each maps to the specific fix and the frappe/erpnext issue that documents the behaviour.
Select what led to the negative-stock error to get its cause, the relevant GitHub issue, and the fix.
Pick what led to the negative-stock error.
The posting-time trap, concretely
Say you receive 100 units at 2pm and ship 40 at 9am the same day, keying the receipt first. To ERPNext the timeline is: 9am — ship 40 from a balance of 0 → negative. The receipt at 2pm doesn't retroactively rescue the 9am instant. The fix is to move the receipt's posting time to, say, 8am — before the shipment. Nothing about the quantities changes; only the sequence does.
Backdated entries are the same trap over a longer window: insert a transaction last month and every balance after it re-sequences, so a point that was fine can now dip below zero (#38014, #37379).
Should you just enable "Allow Negative Stock"?
This is the fork everyone reaches. Before you flip the switch in Stock Settings, answer honestly — the advisor gives you a straight verdict.
Answer three questions about your setup and get a clear verdict on whether enabling Allow Negative Stock is appropriate.
With perpetual inventory and valuation you care about, allowing negative stock produces meaningless COGS — a sale out of negative stock has no valuation rate to cost against, so your margins and Stock-in-Hand go wrong. Fix the sequence or reconcile instead.
Why negative stock and valuation don't mix
If you sell an item while its balance is negative, there is no stock on hand to value the sale against — so ERPNext has no valuation rate to post to Cost of Goods Sold. On a perpetual-inventory setup with FIFO or moving average, this produces wrong COGS and a Stock-in-Hand balance that no longer matches your Stock Ledger. The maintainers put it plainly in #28990: FIFO plus perpetual inventory plus negative stock "makes very little sense in reality." Allow it only where valuation genuinely doesn't matter — or temporarily, then reconcile.
There's a subtler reason not to leave it on globally: it's a single switch for the whole company. You cannot, today, allow negative stock for low-value consumables while enforcing it for expensive finished goods — that granularity is still an open request (#29636). So "just tick it" applies to everything, including the items where accurate valuation matters most.
Fix it properly
Locate exactly where the balance goes negative, fix it by sequence or reconciliation, and prevent recurrence.
Locate exactly where and when the balance first goes negative before you fix anything.
Report: Stock Ledger (Stock > Reports > Stock Ledger)
Filter: the Item + Warehouse from the error
Read: the "Balance Qty" column top to bottom — the first
row where it drops below 0 is your culprit.
Note its posting date + time; the inward entry that
should precede it is what's missing or mis-dated.Find the negative point
Open Stock > Stock Ledger, filter to the item and warehouse in the error, and read the Balance Qty column top to bottom. The first row that goes below zero is your culprit — note its posting date and time.
Decide: sequence error or real shortage
If an inward entry (Purchase Receipt, Stock Entry) exists but is dated after the outward one, it's a sequence error — go to step 3. If nothing accounts for the missing quantity, it's a genuine physical shortage — go to step 4.
Fix a sequence error
Open the inward document, enable Edit Posting Date and Time, and set its posting date-time to before the failing outward document. Save and submit. The outward document will now validate. If you backdated anything, let the resulting Repost Item Valuation finish before trusting the valuation.
Fix a real shortage
Create a Stock Reconciliation (Purpose = Stock Reconciliation) with the actual counted quantity and a valuation rate. ERPNext posts the difference to the stock adjustment account. For batch/serial items this is the supported way to clear a negative bundle (PR #45443).
Fix the cause, or unblock and reconcile?
FAQ
+Why does ERPNext say stock cannot be negative when I clearly received the goods?
Because it checks stock at the exact posting time of each entry, not the day's net. If the outward document's posting time is earlier than the receipt's, the item is negative at that instant. Re-date the receipt to before the issue and the error clears — the quantities don't change, only the sequence does.
+How do I fix a negative stock error in ERPNext without allowing negative stock?
Open the Stock Ledger for the item and warehouse, find the first row where Balance Qty goes below zero, and either correct the posting date-time of the inward entry so it precedes the outward one, or run a Stock Reconciliation with the real counted quantity. Both fix the cause instead of masking it.
+Is it safe to enable Allow Negative Stock in ERPNext?
Only where valuation doesn't matter, or as a temporary unblock you reverse the same day. On a perpetual-inventory setup it corrupts COGS, because a sale from negative stock has no valuation rate to cost against. It's also a global switch, so enabling it affects every item, including the ones where accurate valuation matters most.
+Why can I still submit negative-stock documents with the setting turned off?
There are known edge cases where validation is bypassed — for example an item-level Allow Negative Stock flag interacting with the global one (#38014), or sales invoices submitting despite the setting being off (#45414). Check both the Stock Settings switch and the item's own field, and confirm your version has the relevant fixes.
+How do I clear negative stock on a batch or serial item?
A normal posting-time fix often isn't enough because the negative sits at bundle level. Use a Stock Reconciliation to set the correct batch quantity — the path enabled by PR #45443. Confirm your ERPNext version includes that fix before relying on it.
+Does this apply to ERPNext v14, v15 and v16?
Yes. The point-in-time stock validation, the Allow Negative Stock switch, and the posting-time sequencing behave the same across v14, v15 and v16. Only specific batch/serial fixes (like #45443) are version-dependent — check your release.
+What happens to my accounts if I leave negative stock on?
Your Stock-in-Hand ledger and your General Ledger drift apart, because sales from negative stock post COGS without a real valuation rate. Over a year this shows up as a widening gap between the Stock Balance report and the stock account — the exact symptom covered in our perpetual-inventory reconciliation guide.
Closing
The negative-stock error is ERPNext protecting your valuation, not obstructing you. Treat it as a prompt to check the posting sequence — which is the real fault in the overwhelming majority of cases — rather than a switch to silence. Re-order the receipt and the issue in time, or reconcile to the real count, and the number is right and your books stay clean.
Negative stock spreading across warehouses and no one knows why?
We trace every negative point to its cause, fix the sequencing, reconcile the counts, and set posting-discipline rules so it stops recurring.