Skip to main content
Chunkr AI API provides a configurable approach to error handling during document processing. You can control how the system responds to errors that occur during various processing stages.

Error Handling Strategy

The ErrorHandlingStrategy configuration allows you to specify how the system should respond when errors occur during document processing.

Available Strategies

How Continue Mode Works

When you set error_handling=ErrorHandlingStrategy.CONTINUE, the system will attempt to gracefully handle various types of errors:

LLM Processing Errors

If a segment encounters an LLM error:
  • The system will skip that specific segment instead of failing the entire task
  • Processing continues with the remaining segments
If there is a fallback model configured, the system will use it to process the segment first, if that fails then error handling will continue. See here in LLM Processing how to configure a fallback model.

Layout Analysis Errors

When using Continue mode during layout analysis:
  • If a page encounters layout detection problems, it defaults to segment type “Page”
  • This ensures the content is still accessible even if optimal segmentation fails
  • The page’s content will be processed as a single segment

OCR Strategy Fallbacks

In Continue mode with OCR processing:
  • If OCR extraction encounters errors, it falls back to using the document’s text layer
  • This behaves similarly to OcrStrategy.AUTO mode
  • Ensures text content is still available even when OCR processing fails

Example Usage

When to Use Continue Mode

Consider using ErrorHandlingStrategy.CONTINUE when partial results are better than completely failed processing. For critical applications where accuracy is paramount, you may prefer the default ErrorHandlingStrategy.FAIL to ensure you’re alerted to any processing issues.