Error codes / 15
EFRIS error 15 — the session key expired server-side
Not a problem with your payload. URA expired the AES session key while your client still considered it valid, so the request could not be decrypted. Discard the cached key, redo the T104 handshake, and resend the same document once.
Retrying without renegotiating the key fails identically. The fix is to force a fresh T104, not to resend.
What it actually means
Session keys are negotiated by T104 and cached client-side for a validity window. URA can invalidate one earlier than the client expects — after a service restart, or when a newer session supersedes it. The client then encrypts with a key the server no longer holds, and every call fails with 15 until the key is replaced.
The fix
Clear the key and exchange a new one before resending. A single retry is enough; if the second attempt also returns 15, the cause is the certificate rather than the session.
from efris import EfrisError
try:
client.upload_invoice(document)
except EfrisError as exc:
if exc.code == "15":
client.aes_key = None # discard the stale session key
client.exchange_key() # fresh T104
client.upload_invoice(document)
else:
raise
Why this happens
The library does this automatically on a first 15, so application code rarely needs the block above. It is shown because the same recovery is required in any implementation, and because a retry loop that does not renegotiate will spin forever.
Related
- Error 2253 — The seller's reference number has already been issued
- Error 1526 — pageSize must be 99 or less, despite the documented 100
- All EFRIS error codes
The EFRIS API Kit handles this case already — it is one of the rejections the library was calibrated against. This page stays free either way.