Error Codes

This section provides a comprehensive reference of all error codes that can be returned by the FisCool driver. Understanding these codes is crucial for building robust integrations and implementing proper error handling.

Error Response Format

All APIs return errors in a consistent JSON format:

{
  "status": 500,                    // Application-specific error code
  "error": "Lipsă hârtie în imprimantă."  // User-friendly error message (usually Romanian)
}

Note: HTTP status codes in response headers follow REST conventions, while the status field in the JSON body provides application-specific error classification.

Application Errors (1000-1999)

These errors occur at the application level, before device communication or during internal processing.

Code Error Type Description HTTP Status Common Causes
400 Config Configuration error in request or device setup 400 Bad Request Invalid device configuration, malformed parameters
404 DeviceNotFound The specified device could not be found 404 Not Found Invalid device_id, device not configured, device disconnected
1000 Internal An internal server error occurred 500 Internal Server Error Unexpected runtime errors, system failures
1001 Persistence Error reading from or writing to disk 500 Internal Server Error File system errors, permission issues, disk full
1002 Serialization Error serializing or deserializing data 500 Internal Server Error JSON parsing errors, data format issues
1003 ApiServer HTTP API server error 500 Internal Server Error Rocket framework errors, server startup issues
1004 Connection Connection error before device communication 503 Service Unavailable TCP connection failed, serial port unavailable, network issues
1005 Internet Network or internet connectivity issue 502 Bad Gateway Internet connection lost, DNS resolution failed
1006 Update Error during update process 503 Service Unavailable Update server unavailable, corrupted update files
1007 SecretDataCorrupted Secret data has been tampered with 500 Internal Server Error Configuration file corruption, security breach
1008 Unlicensed Device is not licensed 403 Forbidden License expired, invalid license key
1009 LicenseCorruption License data has been tampered with 403 Forbidden License file corruption, security breach
1010 Network General network error 502 Bad Gateway Network timeout, connection reset
1011 Crypto Cryptographic operation error 500 Internal Server Error Encryption/decryption failed, key issues
1012 LicenseCheckFailed Online license verification failed 503 Service Unavailable License server unavailable, network issues
1013 StartupError Error during application startup 500 Internal Server Error Service initialization failed, dependency issues
1014 NotSupported Operation not supported by device 501 Not Implemented Feature not available on device model, unsupported operation

Fiscal Device Errors (500-599)

These errors are reported by fiscal devices and represent hardware, state, or operational issues.

Hardware and State Errors (500-519)

Code Error Romanian Message Resolution
500 NoPaper Lipsă hârtie în imprimantă. Load paper roll, check paper path
501 NearPaperEnd Rola de hârtie este aproape goală. Replace paper roll soon
502 CoverOpen Capacul imprimantei este deschis. Close device cover properly
503 PrinterMechanismFailure Eroare mecanică imprimantă. Check for mechanical obstructions, service required
504 CutterError Eroare la tăietorul de hârtie. Clear paper jam, check cutter mechanism
505 DeviceBusy Dispozitivul este ocupat. Încercați din nou. Wait and retry, check for ongoing operations
506 ClockError Eroare ceas intern dispozitiv. Synchronize device time, check internal battery
507 LowBattery Baterie descărcată. Connect to power, replace backup battery
508 GeneralDeviceError Eroare generală dispozitiv Check device connection, restart device
509 GeneralDeviceErrorMessage Device-specific error message Refer to device manual for specific error

Fiscal Memory and Electronic Journal Errors (520-529)

Code Error Romanian Message Resolution
520 FiscalMemoryFull Memoria fiscală este plină. Device replacement required, contact tax authorities
521 FiscalMemoryError Eroare citire/scriere memorie fiscală. Service required, possible hardware failure
522 FiscalMemoryNearFull Memoria fiscală este aproape plină. Plan device replacement, monitor usage
523 EJFull Jurnalul electronic este plin. Export and archive EJ data, clear if possible
524 EJError Eroare jurnal electronic. Check EJ status, service may be required
525 EJNearFull Jurnalul electronic este aproape plin. Export EJ data regularly, monitor space

Operational Errors (530-549)

Code Error Romanian Message Resolution
530 ReceiptOpen Există deja un bon fiscal deschis. Anulați-l sau finalizați-l. Cancel or finalize the current receipt
531 ReceiptNotOpen Niciun bon fiscal deschis pentru această operațiune. Open a new receipt before adding items
532 DayClosed Raportul Z a fost deja emis. Deschideți o nouă zi fiscală. Wait for next fiscal day or open new day
533 DayNotClosed Ziua fiscală nu este închisă (Raport Z neemis). Print Z report to close fiscal day
534 DailyLimitReached Limită zilnică atinsă Print Z report, wait for next fiscal day
535 TimeNeedsSync Data/ora dispozitivului necesită sincronizare. Synchronize device time with system time
536 CashLow Fonduri insuficiente în casă pentru extragere. Add cash to drawer or reduce withdrawal amount
537 InvalidAmount Sumă invalidă pentru operațiune (ex: zero). Use valid amount greater than zero
538 NotFiscalized Dispozitivul nu este fiscalizat. Fiscalize device through authorized technician
539 DailyReportingRequired Este necesară emiterea raportului Z. Print mandatory Z report
540 InvalidVatRate Cotă TVA invalidă sau inactivă pe dispozitiv. Use valid VAT rate configured on device
541 OperationNotPermitted Operațiune nepermisă în starea curentă. Check device state and operation sequence
542 BlockingPeriodActive Dispozitiv blocat temporar (ex: 24h fără comunicare). Maintain regular communication, follow procedure to unblock
543 TooManyArticlesOnReceipt Prea multe articole pe bonul fiscal. Split transaction into multiple receipts
544 ZNeeded Este necesar să se tipărească raportul Z. Print Z report before continuing

Command and Syntax Errors (550-559)

Code Error Romanian Message Resolution
550 InvalidCommand Comandă invalidă pentru dispozitiv. Use supported commands for this device model
551 InvalidSyntaxOrParam Sintaxă sau parametru invalid pentru comandă. Check parameter format and values
552 WrongOperatorPassword Parolă operator incorectă. Use correct operator password
599 Other Device-specific error with original code Refer to device manual for specific error code

POS Terminal Errors (600-619)

These errors are specific to POS terminal operations and card processing.

Code Error Romanian Message Resolution
600 PosDeclinedGeneric Tranzacție POS refuzată. Check card validity, try different payment method
601 PosDeclinedInsufficientFunds Tranzacție POS refuzată: Fonduri insuficiente. Customer needs to use different card or payment method
602 PosDeclinedCardExpired Tranzacție POS refuzată: Card expirat. Customer needs to use valid, non-expired card
603 PosDeclinedIncorrectPin Tranzacție POS refuzată: PIN incorect. Customer should retry with correct PIN
604 PosTransactionCancelled Tranzacție POS anulată. Transaction was cancelled by user or system
605 PosTimeoutWaitingResponse Tranzacție POS eșuată: Timp de așteptare răspuns depășit. Check terminal connection, retry transaction
606 PosCommunicationError Eroare de comunicație cu terminalul POS. Check terminal connection and cables
607 PosTransactionReversed Tranzacție POS inversată (ex: refuz semnătură). Transaction was reversed due to signature reject or other issue
608 PosDeclinedByTerminal Tranzacție POS refuzată de terminal (eroare locală). Terminal detected local error, check terminal status
609 PosSettlementFailed Închiderea de zi POS (settlement) a eșuat. Check terminal connection, retry settlement
610 PosInvalidResponseData Răspuns invalid de la terminalul POS. Check terminal firmware, contact support
611 PosOperationFailed Operațiune POS eșuată Check error details for specific failure reason

Printer Errors (2000-2999)

These errors occur when using the printing subsystem for non-fiscal printing operations.

Code Error Description Resolution
2001 PrinterNotFound The specified printer could not be found Check printer installation and connection
2002 Tauri A Tauri framework error occurred Check application logs, restart application
2003 HtmlRendering Error rendering HTML content for printing Check HTML template validity, install required fonts
2004 PrintJob Error with print job execution Check printer status, paper availability
2005 Resource Required resource could not be found Check resource paths, verify file permissions

Error Handling Best Practices

For Application Developers

  • Status Code Ranges: Use error code ranges to categorize error types:
    • 400, 404: Client/configuration errors - fix request
    • 1000-1999: Application errors - check system state
    • 500-599: Device errors - check device status
    • 600-619: POS errors - handle transaction state
    • 2000+: Printer errors - check printer setup
  • Retry Logic: Implement appropriate retry logic:
    • Temporary errors (505, 1004, 1005): Safe to retry with backoff
    • State errors (530, 531, 532): Fix state before retry
    • Configuration errors (400, 404, 1008): Don't retry without fixing issue
  • User Messaging: Use the Romanian error messages for end-user display
  • Logging: Always log both the error code and full error context

Common Error Scenarios

Receipt Printing Workflow Errors
// Check device state before starting
GET /devices/{device_id}

// Common sequence errors:
530 (ReceiptOpen) → Cancel existing receipt first
531 (ReceiptNotOpen) → Initialize receipt before adding items
537 (InvalidAmount) → Validate amounts are > 0
544 (ZNeeded) → Print Z report before continuing
Device Connection Issues
// Connection error progression:
404 (DeviceNotFound) → Device not configured
1004 (Connection) → Network/serial connection failed
505 (DeviceBusy) → Device responding but busy
508 (GeneralDeviceError) → Device communication established but error occurred
POS Transaction Handling
// POS error handling:
600-603 → Card/payment issue - customer action required
604 → Transaction cancelled - no further action needed
605-606 → Communication issue - retry possible
609 → Settlement failed - check terminal status

Integration Testing

Test error handling for these critical scenarios:

  • Device disconnection during operation
  • Paper out conditions
  • Invalid receipt sequences
  • POS terminal communication failures
  • Z report requirements
  • License validation failures