{"record":{"id":"6c95b62bc3a51bd7","repo":"crewAIInc/crewAI","slug":"image-filename-height-height-px-exceeds-max","errorCode":null,"errorMessage":"Image '{filename}' height ({height}px) exceeds maximum ({constraints.max_height}px)","messagePattern":"Image '(.+?)' height \\((.+?)px\\) exceeds maximum \\((.+?)px\\)","errorType":"validation","errorClass":"FileValidationError","httpStatus":null,"severity":"error","filePath":"lib/crewai-files/src/crewai_files/processing/validators.py","lineNumber":283,"sourceCode":"            width, height = dimensions\n\n            if constraints.max_width and width > constraints.max_width:\n                msg = (\n                    f\"Image '{filename}' width ({width}px) exceeds \"\n                    f\"maximum ({constraints.max_width}px)\"\n                )\n                errors.append(msg)\n                if raise_on_error:\n                    raise FileValidationError(msg, file_name=filename)\n\n            if constraints.max_height and height > constraints.max_height:\n                msg = (\n                    f\"Image '{filename}' height ({height}px) exceeds \"\n                    f\"maximum ({constraints.max_height}px)\"\n                )\n                errors.append(msg)\n                if raise_on_error:\n                    raise FileValidationError(msg, file_name=filename)\n\n    return errors\n\n\ndef validate_pdf(\n    file: PDFFile,\n    constraints: PDFConstraints,\n    *,\n    raise_on_error: bool = True,\n) -> Sequence[str]:\n    \"\"\"Validate a PDF file against constraints.\n\n    Args:\n        file: The PDF file to validate.\n        constraints: PDF constraints to validate against.\n        raise_on_error: If True, raise exceptions on validation failure.\n\n    Returns:","sourceCodeStart":265,"sourceCodeEnd":301,"githubUrl":"https://github.com/crewAIInc/crewAI/blob/754d7323beb2fd042e33444a115ea2d5a47193f0/lib/crewai-files/src/crewai_files/processing/validators.py#L265-L301","documentation":"The second dimension check in validate_image: raises FileValidationError when height > constraints.max_height, with actual and maximum pixel counts in the message. Evaluated after the width check on the same probed dimensions; only reached when the width check passed (or its raise_on_error was False).","triggerScenarios":"Validating an image taller than max_height (e.g. a 3000px-tall screenshot against max_height=1280) via validate_image or STRICT-mode processing. Tall screenshots, panoramic stitches, and long vertical captures are the usual offenders.","commonSituations":"Full-page screenshots and chat captures that are narrow but very tall; poster/infographic uploads; aspect-ratio-unaware limits set per dimension.","solutions":["Enable FileHandling.AUTO to let the processor resize within max_width/max_height bounds (aspect ratio preserved).","Split tall screenshots into segments upstream before attaching.","Raise max_height to match real content (e.g. 4096 for full-page captures).","Check image.size yourself before validation and reject/resize with a custom message."],"exampleFix":"# before\nconstraints = ImageConstraints(max_height=1280)\nvalidate_image(screenshot, constraints)  # FileValidationError: height 3600px exceeds maximum 1280px\n\n# after\nfrom crewai_files.processing.enums import FileHandling\nprocessor = FileProcessor(constraints=constraints, handling=FileHandling.AUTO)\nout = processor.process(screenshot)  # resized to fit height limit","handlingStrategy":"validation","validationCode":"from PIL import Image\n\nwith Image.open(io.BytesIO(content)) as img:\n    if constraints.max_height and img.height > constraints.max_height:\n        return resize_or_reject(file, img.size)","typeGuard":null,"tryCatchPattern":"from crewai_files.processing.exceptions import FileValidationError\n\ntry:\n    processor.process(img_file)\nexcept FileValidationError as e:\n    if \"height\" in str(e):\n        img_file = fit_within(img_file, max_height=constraints.max_height)\n        return processor.process(img_file)\n    raise","preventionTips":["Check both dimensions before attaching; tall screenshots are the usual failure.","Enable AUTO mode to resize within bounds while preserving aspect ratio.","Split very tall captures into multiple images upstream."],"tags":["validation","image","dimensions","constraints","resize"],"backgroundTag":null,"analyzedSha":"754d7323beb2fd042e33444a115ea2d5a47193f0","analyzedAt":"2026-08-15T04:06:56.746Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}