crewAIInc/crewAI · error · FileValidationError
"; ".join(errors)
Error message
"; ".join(errors)
What it means
The FileProcessor in STRICT mode collects all constraint violations (size, format, dimensions, duration) via validate() and, if any are found, raises FileValidationError with all messages joined by '; '. STRICT means 'fail on limit breach' (vs WARN which logs, AUTO which resizes/compresses, CHUNK which splits), so this error reports the concrete violations, e.g. image too large or wrong MIME type.
Source
Thrown at lib/crewai-files/src/crewai_files/processing/processor.py:135
The processed file (possibly transformed) or a sequence of files
if the file was chunked.
Raises:
FileProcessingError: If file.mode is STRICT and processing fails.
"""
if self.constraints is None:
return file
mode = self._get_mode(file)
try:
errors = self.validate(file)
if not errors:
return file
if mode == FileHandling.STRICT:
raise FileValidationError("; ".join(errors), file_name=file.filename)
if mode == FileHandling.WARN:
for error in errors:
logger.warning(error)
return file
if mode == FileHandling.AUTO:
return self._auto_process(file)
if mode == FileHandling.CHUNK:
return self._chunk_process(file)
return file
except (FileValidationError, FileTooLargeError, UnsupportedFileTypeError):
raise
except Exception as e:
logger.error(f"Error processing file '{file.filename}': {e}")View on GitHub (pinned to 754d7323be)
Solutions
- Read the '; '-joined messages: each segment names the exact violation (size/format/dimension/duration) — fix that condition.
- Switch handling to FileHandling.AUTO so the processor resizes/compresses files to fit constraints automatically.
- Use FileHandling.WARN during development to see violations without aborting.
- Use FileHandling.CHUNK for oversized PDFs so they are split into page-range chunks.
Example fix
# before processor = FileProcessor(constraints=ImageConstraints(...), handling=FileHandling.STRICT) out = processor.process(image_file) # FileValidationError if any limit exceeded # after processor = FileProcessor(constraints=ImageConstraints(...), handling=FileHandling.AUTO) out = processor.process(image_file) # auto-resized to fit limits
Defensive patterns
Strategy: try-catch
Validate before calling
errors = processor.validate(file)
if errors:
logger.warning("validation issues for %s: %s", file.filename, "; ".join(errors))
# decide: reject, or switch handling mode Try / catch
from crewai_files.processing.exceptions import FileValidationError
try:
out = processor.process(file)
except FileValidationError as e:
logger.error("file %s rejected: %s", e.file_name, e)
rejected.append(file) Prevention
- Run validate() (non-raising) first and log the error list instead of relying on STRICT exceptions.
- Use AUTO/WARN in interactive flows and STRICT only in batch validation jobs.
- Keep constraint objects per integration rather than one global set.
When it happens
Trigger: Processing a file whose constraints validation returns one or more errors while FileHandling.STRICT is set: oversized image, unsupported format, width beyond max_width, audio longer than max_duration_seconds, PDF over max_pages, etc.
Common situations: Defaulting to STRICT in production to guarantee provider limits are honored, then feeding user-uploaded files that exceed max_size_bytes; leaving max_width/max_height unset in a shared constraints object so another team's tight limits apply; uploading phone photos (4000px+) against a 2048px constraint.
Related errors
- str(e)
- {file_type} '{filename}' size ({_format_size(file_size)}) ex
- {file_type} format '{content_type}' is not supported. Suppor
- Image '{filename}' width ({width}px) exceeds maximum ({const
- Image '{filename}' height ({height}px) exceeds maximum ({con
AI-assisted analysis of crewAIInc/crewAI@754d7323be (2026-08-15).
Data as JSON: /api/errors/60d9c50fd004eb31.
Report an issue: GitHub.