KSEF-21180:KSeF session status does not allow this operation
Fix: Open a fresh session and retry. Never reuse a referenceNumber after the session has moved past status 200.
The KSeF 2.0 API rejected your request because the session referenced by referenceNumber is in a state that does not permit the requested action. Typical example: attempting POST /sessions/online/{ref}/invoices while the session status is 415 (closing) or an already-terminal status such as 445 (no valid invoices). The invoice itself was never processed.
Engine Classification
Financial or legal field · Modification blocked by policy
Reason: Cannot be fixed at the XML/document level — this is an API state error. The client must open a new session.
What is KSEF-21180?
KSEF-21180 is a fatal validation rule defined in the KSeF 2.0 specification (PL national rules). It validates the 435 (processing terminated), and 445 (finished — no valid invoices). element under {referenceNumber} > close. The Polish message returned is "Status sesji nie pozwala na wykonanie operacji". The error payload usually includes the numeric session status. States that block invoice submission include 415 (closing initiated), 425 in the UBL invoice XML.
When this rule fires, the invoice is rejected by Peppol access points and never reaches the buyer.
Target path: Endpoints that surface this error include POST /sessions/online/{referenceNumber}/invoices, POST /sessions/online/{referenceNumber}/close, and POST /sessions/batch/{referenceNumber}/close. The Polish message returned is "Status sesji nie pozwala na wykonanie operacji". The error payload usually includes the numeric session status. States that block invoice submission include 415 (closing initiated), 425/435 (processing terminated), and 445 (finished — no valid invoices).
Why This Error Matters
KSeF 2.0 becomes mandatory for large taxpayers on 1 February 2026 and for the rest of the market on 1 April 2026. Losing invoices to 21180 during peak load — month-end, quarter-close — creates compliance gaps that the Polish tax authority can penalise under the KSeF sanction regime.
KSEF-21180 is a hard failure — the invoice must be corrected and re-sent before it can reach the recipient.
Blocks invoice submission in KSeF 2.0. High risk of missed month-end filings if left unhandled in production integrations.
Validator Behavior
- ·Causes invoice rejection
- ·Error returned: KSEF-21180
- ·Specification: KSeF 2.0
How to Fix It
XML Example
Generic example based on the rule's target XPath. Your actual XML structure may differ.
<!-- Triggers validation error --> <435 (processing terminated), and 445 (finished — no valid invoices).></435 (processing terminated), and 445 (finished — no valid invoices).>
<!-- Corrected --> <435 (processing terminated), and 445 (finished — no valid invoices).>VALID_VALUE</435 (processing terminated), and 445 (finished — no valid invoices).>
Technical Reference
Endpoints that surface this error include POST /sessions/online/{referenceNumber}/invoices, POST /sessions/online/{referenceNumber}/close, and POST /sessions/batch/{referenceNumber}/close. The Polish message returned is "Status sesji nie pozwala na wykonanie operacji". The error payload usually includes the numeric session status. States that block invoice submission include 415 (closing initiated), 425/435 (processing terminated), and 445 (finished — no valid invoices).Common Causes
- ·Session left open past its idle timeout, then reused
- ·Race condition: close request and invoice submit sent in parallel
- ·Retry logic that keeps re-sending against a session already in status 445
- ·Load balancer replaying a stale request after failover
Seeing this in production? The API handles KSEF-21180 automatically. See the fix response →
Commonly Seen In
Frequently Asked Questions
The KSeF session referenced by your API call is in a state that does not permit the operation you requested — for example, trying to submit an invoice to a session that has already been closed.
Terminal statuses like 415 (closing), 425/435 (terminated), and 445 (finished with no valid invoices). Session status 200 (open) is the only state that reliably accepts new invoice submissions.
No. Once you get 21180, that referenceNumber is dead. Open a new session and retry against the new referenceNumber.
No. 21180 is an API lifecycle error, not an XML validation error. Invoice Navigator flags it in the log so your integration can reopen the session, but the fix has to happen in the client code.
The 21180 code is defined for KSeF 2.0. KSeF 1.0 uses a different error taxonomy that will be sunset in 2026.
Related Errors
Related Content
Last updated: 7 July 2026
Validate your invoice
Drop your XML here to check for KSEF-21180
Detect KSEF-21180 before submission
This error involves a financial field that can't be auto-modified. We'll flag it with a clear diagnosis so you can fix it at the source.