crewAIInc/crewAI · warning · ValueError

Project name '{name}' would generate folder name '{folder_na

Error message

Project name '{name}' would generate folder name '{folder_name}' which is reserved. Reserved names are: {', '.join(sorted(reserved_names))}. Please choose a different name.

What it means

Raised as FileTooLargeError by crewai-files validators when a file or image exceeds the configured maximum size for its type. The validator compares actual byte size against constraints (e.g. ImageConstraints.max_size) and, with raise_on_error=True (the default), aborts processing with a structured error carrying file_name, actual_size, and max_size.

Source

Thrown at lib/cli/src/crewai_cli/create_crew.py:87

    if folder_name[0].isdigit():
        raise ValueError(
            f"Project name '{name}' would generate folder name '{folder_name}' which cannot start with a digit (invalid Python module name)"
        )

    if keyword.iskeyword(folder_name):
        raise ValueError(
            f"Project name '{name}' would generate folder name '{folder_name}' which is a reserved Python keyword"
        )

    if not folder_name.isidentifier():
        raise ValueError(
            f"Project name '{name}' would generate invalid Python module name '{folder_name}'"
        )

    reserved_names = get_reserved_script_names()
    if folder_name in reserved_names:
        raise ValueError(
            f"Project name '{name}' would generate folder name '{folder_name}' which is reserved. "
            f"Reserved names are: {', '.join(sorted(reserved_names))}. "
            "Please choose a different name."
        )

    class_name = name.replace("_", " ").replace("-", " ").title().replace(" ", "")

    class_name = re.sub(r"[^a-zA-Z0-9_]", "", class_name)

    if not class_name:
        raise ValueError(
            f"Project name '{name}' contains no valid characters for a Python class name"
        )

    if class_name[0].isdigit():
        raise ValueError(
            f"Project name '{name}' would generate class name '{class_name}' which cannot start with a digit"
        )

View on GitHub (pinned to 754d7323be)

Solutions

  1. Compress or downscale the file below the limit (resize images, re-encode JPEG at lower quality, or split PDFs)
  2. If the use case legitimately needs larger files, raise max_size in the constraints object passed to the validator
  3. Catch FileTooLargeError where graceful user feedback is needed, and surface filename plus the actual vs maximum sizes from the exception fields
  4. Pre-check size in the upload path (client or endpoint) so oversized files are rejected before any processing begins

Example fix

# before
validate_image(img, constraints)  # 12MB image, max_size=10MB -> FileTooLargeError

# after
from PIL import Image
im = Image.open(path); im.thumbnail((2000, 2000)); im.save(path, quality=85)
validate_image(img, constraints)  # now under limit

# or raise the ceiling:
constraints = ImageConstraints(max_size=20 * 1024 * 1024)
Defensive patterns

Strategy: validation

Validate before calling

import os

def size_within_limit(path: str, max_size: int) -> bool:
    return os.path.getsize(path) <= max_size

# gate uploads before calling validators:
if not size_within_limit(path, constraints.max_size):
    return error_response(f'{path} exceeds {constraints.max_size} bytes — compress first')

Try / catch

from crewai_files.processing.errors import FileTooLargeError

try:
    errors = validate_image(img, constraints)
except FileTooLargeError as e:
    # structured fields for user feedback:
    return bad_request(f"{e.file_name} is {e.actual_size} bytes; limit {e.max_size}")

Prevention

When it happens

Trigger: Calling validate_image/validate_file-family helpers (validators.py:186-196) with raise_on_error=True on a file whose byte size exceeds the constraints' max_size — e.g. uploading a 12 MB PNG when ImageConstraints caps images at 10 MB. With raise_on_error=False the same message is only appended to the returned errors list.

Common situations: User uploads raw photos/screenshots/PDFs above the agent's processing cap; constraints tightened between releases so previously accepted files now fail; MB vs MiB confusion when configuring max_size.

Related errors


AI-assisted analysis of crewAIInc/crewAI@754d7323be (2026-08-15). Data as JSON: /api/errors/4b60cac6ea3fb3fc. Report an issue: GitHub.