Exception Hierarchy
All OCR exceptions inherit fromOCRError, allowing you to catch all OCR errors at once or handle specific exceptions individually.
Base: OCRError
Parent of all OCR exceptions. Carries 3 attributes:| Attribute | Type | Description |
|---|---|---|
message | str | Error message |
error_code | str | None | Machine-readable error code (e.g. "LAYER1_TIMEOUT") |
original_error | Exception | None | Wrapped original exception (if any) |
str() output format: [ERROR_CODE] message (Original: original error)
OCRProviderError
Raised during engine initialization and dependency errors.| error_code | When |
|---|---|
UNSUPPORTED_LANGUAGE | Language not supported by the engine |
READER_INIT_FAILED | EasyOCR reader creation failed |
ENGINE_INIT_FAILED | RapidOCR engine initialization failed |
TESSERACT_NOT_INSTALLED | Tesseract not installed on the system |
VLLM_NOT_AVAILABLE | vLLM package not installed (DeepSeek) |
UNSUPPORTED_MODEL_ARCHITECTURE | DeepSeek model architecture not supported by vLLM |
MODEL_INIT_FAILED | DeepSeek model loading failed |
CLIENT_INIT_FAILED | Ollama client connection failed |
OLLAMA_NOT_AVAILABLE | ollama package not installed |
OCRFileNotFoundError
Raised when the file does not exist or the path is not a file. Thrown by Layer 0 (document_converter).| error_code | When |
|---|---|
FILE_NOT_FOUND | File does not exist |
NOT_A_FILE | Path points to a directory |
OCRUnsupportedFormatError
Raised when an unsupported file format is provided. Thrown by Layer 0. Supported formats:.png, .jpg, .jpeg, .bmp, .tiff, .tif, .gif, .webp, .pdf
| error_code | When |
|---|---|
UNSUPPORTED_FORMAT | File has an unsupported extension |
OCRProcessingError
Raised when an error occurs at the engine level during OCR processing. Each engine uses its own error code.| error_code | Engine | When |
|---|---|---|
EASYOCR_PROCESSING_FAILED | EasyOCR | readtext call failed |
RAPIDOCR_PROCESSING_FAILED | RapidOCR | OCR call failed |
TESSERACT_PROCESSING_FAILED | Tesseract | image_to_data call failed |
DEEPSEEK_PROCESSING_FAILED | DeepSeek | vLLM generate failed |
DEEPSEEK_BATCH_PROCESSING_FAILED | DeepSeek | Batch processing failed |
DEEPSEEK_OLLAMA_PROCESSING_FAILED | DeepSeek Ollama | Ollama streaming failed |
PADDLE_PROCESSING_FAILED | PaddleOCR | predict call failed |
PDF_CONVERSION_FAILED | Layer 0 | PDF to image conversion failed |
IMAGE_LOAD_FAILED | Layer 0 | Image could not be loaded |
MISSING_DEPENDENCY | Layer 0 | PyMuPDF (fitz) not installed |
OCRTimeoutError
Raised whenlayer_1_timeout is exceeded in the OCR orchestrator. Applied per page — if page 3 of a 5-page PDF times out, only that page raises the error.
| error_code | When |
|---|---|
LAYER1_TIMEOUT | layer_1_timeout seconds exceeded |

