Error handling

Understanding how automation apps handle empty or null results can help you troubleshoot extraction issues and handle errors in downstream systems.

When a result can’t be extracted for a specific field, the field returns either an empty string ("") or null. These values are displayed differently across AI Hub interfaces.

InterfaceConditionDisplay messageActual value
Project editorResult is "" or null with no cleaningNo value found"" or null
Project editorResult is "" or null after cleaningCleaning returned no value"" or null
Project editorCustom function errorCustom function errorError details
Ground truth datasets and accuracy testsResult is "" or nullNo value found"" or null
Human reviewResult is ""No value found""
Human reviewResult is nullnullnull
Exported results, downstream integrations, and API/SDK responsesResult is "" or nullraw value"" or null

Handling empty results in custom functions

When writing custom functions, treat both "" and null as empty values to ensure predictable behavior across different extraction scenarios.

When processing app results through APIs or integration functions, implement error handling for empty field values.

1def process_field_value(field_result):
2 """Handle different empty value scenarios."""
3
4 # Check for null or empty string
5 if field_result is None or field_result == "":
6 # Apply business logic for missing values
7 return "NOT_FOUND"
8
9 return field_result

Customizing error messages

Customize how automation apps handle missing values using specific prompts or custom functions.

  • Field prompts — Include instructions like If not found, return ‘Not Available’ in your field description or prompt.

  • Cleaning function — Transform empty results into standardized messages.

    1def standardize_empty(previous_line, context):
    2 """Standardize empty field responses."""
    3 if not previous_line or previous_line.strip() == "":
    4 return "Not Found"
    5 return previous_line
  • Validation function — Flag empty values for human review when the field is required.

    1def validate_required_field(field_value, context):
    2 """Ensure required fields have values."""
    3 if not field_value or field_value.strip() == "":
    4 return "This field is required"
    5 return None

Troubleshooting extraction failures

If fields consistently return empty values, try these troubleshooting steps.

  • Review field configuration — Verify that the field name and description accurately describe the data you want to extract, and that the field type is appropriate to the data.

  • Check digitization quality — Poor OCR quality can prevent successful extraction. Review digitization settings and view the document in text-only view to verify that the data you want to extract is present and legible.

  • Test with different models — Some models perform better with specific document types or extraction scenarios.