KSEF-21177:Invoice issue date is outside the allowed KSeF window
Fix: Normalise P_1 to Europe/Warsaw before serialisation; for genuinely backdated invoices switch to the correction (KOR) flow; for future-dated invoices hold submission until the issue date arrives. Provide the required value in the free validator.
KSEF-21177 is a server-side validation error returned by the Polish Krajowy System e-Faktur (KSeF) when the FA(2) schema element P_1 (data wystawienia / invoice issue date) is outside the window the platform accepts. KSeF rejects invoices whose issue date is in the future, more than the allowed look-back from the submission timestamp, or in a different reporting period than the one the schema header (DataWytworzeniaFa) declares. The mandate-live behaviour since the February 2026 go-live is strict: the platform returns 400 with this code and the invoice is not stored.
Engine Classification
Business data required · Explicit input workflow · No assumptions made
What is KSEF-21177?
KSEF-21177 is a fatal validation rule defined in the ksef specification (PL national rules).
When this rule fires, the invoice is rejected by Peppol access points and never reaches the buyer.
Why This Error Matters
Polish B2B e-invoicing has been mandatory in KSeF since February 2026. A KSEF-21177 means the invoice is not in the platform — and under the mandate, an invoice not in KSeF is not legally issued for VAT purposes.
KSEF-21177 is a hard failure — the invoice must be corrected and re-sent before it can reach the recipient.
Validator Behavior
- ·Causes invoice rejection
- ·Error returned: KSEF-21177
- ·Specification: ksef
Before / After
<P_1>2026-04-15</P_1> <DataWytworzeniaFa>2026-05-05T09:30:00Z</DataWytworzeniaFa>
<P_1>2026-05-05</P_1> <DataWytworzeniaFa>2026-05-05T09:30:00+02:00</DataWytworzeniaFa>
Technical Reference
Seeing this in production? The API handles KSEF-21177 automatically. See the fix response →
Frequently Asked Questions
Europe/Warsaw, regardless of the time zone in DataWytworzeniaFa. Submitters in Western Europe should normalise local time to Warsaw before serialising P_1.
Ordinary invoices accept up to ~14 days look-back (subject to platform tolerance). Older issue dates must be issued as a correction (faktura korygująca) referencing the original document, or sent through the RR/marginalna path where applicable.
No. KSeF rejects P_1 > current platform date. Hold the submission queue until the issue date arrives; do not artificially advance the platform date.
KSEF-21177 is a server-side check. The FA(2) XSD itself accepts a wide range of dates; the look-back window is enforced by the platform after schema validation passes.
KSEF-21177 fires on every document accepted by the platform: B2B invoices under the mandate, B2C invoices with a reduced data set, and KOR/INVO corrections. Only out-of-scope cash receipts (paragony) are exempt.
Related Content
Last updated: 5 May 2026
Validate your invoice
Drop your XML here to check for KSEF-21177
Fix KSEF-21177 with guided input
Upload your invoice and we'll ask for the missing data, then apply a safe, auditable fix.