crewAIInc/crewAI · error · UnsupportedFileTypeError
Provider '{provider_name}' does not support {type_name}
Error message
Provider '{provider_name}' does not support {type_name} What it means
Raised by crewai-files validation when a FileInput's type (e.g. images, PDFs) is not in the provider's supported set defined by its ProviderConstraints. It only raises when raise_on_error=True (the default); otherwise the same message is returned in the error list. The exception is UnsupportedFileTypeError, a subclass of FileValidationError, and carries file_name and content_type context.
Source
Thrown at lib/crewai-files/src/crewai_files/processing/validators.py:504
raise_on_error: bool,
) -> Sequence[str]:
"""Check if file type is unsupported and handle error.
Args:
file: The file being validated.
provider_name: Name of the provider.
type_name: Name of the file type (e.g., "images", "PDFs").
raise_on_error: If True, raise exception instead of returning errors.
Returns:
List with error message (only returns when raise_on_error is False).
Raises:
UnsupportedFileTypeError: If raise_on_error is True.
"""
msg = f"Provider '{provider_name}' does not support {type_name}"
if raise_on_error:
raise UnsupportedFileTypeError(
msg, file_name=file.filename, content_type=file.content_type
)
return [msg]
def validate_file(
file: FileInput,
constraints: ProviderConstraints,
*,
raise_on_error: bool = True,
) -> Sequence[str]:
"""Validate a file against provider constraints.
Dispatches to the appropriate validator based on file type.
Args:
file: The file to validate.
constraints: Provider constraints to validate against.View on GitHub (pinned to 754d7323be)
Solutions
- Check the file's extension/content_type against the provider's ProviderConstraints.supported_extensions before uploading.
- Route the file to a provider whose constraints include that type, or convert the file (e.g. webp -> png, docx -> pdf) before upload.
- Extend the ProviderConstraints configuration for the provider if the underlying API actually supports the type.
- Call validators with raise_on_error=False and handle the returned error strings when you prefer soft-failure behavior.
Example fix
// before
result = anthropic_uploader.upload(file) # raises UnsupportedFileTypeError for .webp
# after
from crewai_files.processing.validators import validate_file
errors = validate_file(file, constraints, raise_on_error=False)
if errors:
logger.warning("Skipping %s: %s", file.filename, errors)
else:
result = anthropic_uploader.upload(file) Defensive patterns
Strategy: validation
Validate before calling
from pathlib import Path
ext = Path(file.filename).suffix.lower()
if ext not in constraints.supported_extensions:
logger.warning("skip %s: %s not supported", file.filename, ext)
return
result = uploader.upload(file) Type guard
def is_supported_type(file: FileInput, constraints: ProviderConstraints) -> bool:
ext = Path(file.filename).suffix.lower()
return ext in constraints.supported_extensions Try / catch
from crewai_files.processing.exceptions import UnsupportedFileTypeError
try:
uploader.upload(file)
except UnsupportedFileTypeError as e:
logger.warning("unsupported for provider: %s", e) Prevention
- Log each provider's ProviderConstraints.supported_extensions at startup so operators see the accepted set.
- Normalize/convert uploads to formats every target provider accepts before dispatch.
- Run validate_file with raise_on_error=False first when accepting untrusted user files.
When it happens
Trigger: Calling validate_file(file, constraints) or a provider upload path that validates first, where the file's extension/content_type is absent from constraints.supported_extensions (e.g. sending .webp to a provider whose constraints only list .png/.jpg, or a PDF to an image-only provider) with raise_on_error=True.
Common situations: Mixing up provider constraint sets, adding a new file format to uploads without updating ProviderConstraints, auto-detecting content_type as application/octet-stream so no extension matches, or routing every file through one provider (e.g. anthropic) that only accepts a narrow type set.
Related errors
- Project name '{name}' would generate folder name '{folder_na
- Project name '{name}' contains no valid characters for a Pyt
- {file_type} format '{content_type}' is not supported. Suppor
- Project name '{name}' would generate class name '{class_name
- Project name '{name}' would generate class name '{class_name
AI-assisted analysis of crewAIInc/crewAI@754d7323be (2026-08-15).
Data as JSON: /api/errors/b49e3e8e073bde6c.
Report an issue: GitHub.