Skip to content

PRS004 - Input Too Large

Description

The input document exceeds the maximum allowed size. This limit exists to prevent memory exhaustion and denial-of-service scenarios.

Severity

Error

When This Occurs

  • Document size exceeds the configured max_input_size
  • Default limit is 10 MB (10,485,760 bytes)

Example

from dppvalidator import ValidationEngine

engine = ValidationEngine()
result = engine.validate("very_large_document.json")
# PRS004 if file > 10 MB

Resolution

  1. Increase the size limit if needed:
from dppvalidator import ValidationEngine

engine = ValidationEngine(max_input_size=50_000_000)  # 50 MB
result = engine.validate("large_document.json")
  1. Split large documents into smaller parts:
# Process products individually
for product_file in product_files:
    result = engine.validate(product_file)
  1. Remove unnecessary data before validation:
import json

with open("large.json") as f:
    data = json.load(f)

# Remove large binary data
if "productImage" in data.get("credentialSubject", {}).get("product", {}):
    del data["credentialSubject"]["product"]["productImage"]

result = engine.validate(data)

Configuration

The default limit can be configured via environment variable:

export DPPVALIDATOR_MAX_INPUT_SIZE=52428800  # 50 MB