What the agent does
Pillow 10 removed Image.ANTIALIAS, a name that had been an alias for the Lanczos filter since Pillow 2.7 and had printed a deprecation warning since 9.1. Code that passes it to thumbnail() or resize() now raises AttributeError: module 'PIL.Image' has no attribute 'ANTIALIAS'. The agent first reads how the project asks for Pillow. In a small Flask image host like vas3k/i.vas3k.ru, requirements.txt says Pillow>=3.0.0, a floor with no ceiling, so the next rebuild of the server's virtualenv installs the newest release and the resizing code breaks without a commit.
It then finds every use, since the name appears wherever someone copied a resize. This repository has four: image.thumbnail(orig_save_size, Image.ANTIALIAS) in save_full_image() in image.py, which every upload goes through, and three more in app.py, in length_fit_media, square_fit_media and width_fit_media, the routes behind /500/name.jpg, /square/500/name.jpg and /width/500/name.jpg. The agent installs the requirements in a clean virtualenv, creates a JPEG in memory, and calls save_full_image on it. The traceback ends at image.py, line 30.
Reproducing through the routes shows something a search does not. Each resize route writes its result under images/ and skips the work when that file already exists, then hands the path to nginx in an X-Accel-Redirect header. So after the upgrade a size that was generated earlier still answers 200, and only a size nobody has requested before answers 500. The agent demonstrates both with Flask's test client: it requests one size with the fix in place, removes the fix, and requests that size and a new one. That explains why the breakage looks random in production and why the front page of a blog keeps working while new posts lose their pictures. It also notes that upload() catches only IOError around save_full_image, so the AttributeError skips the handler that returns "Image upload error" and the request fails with a 500.
The replacement is chosen against the version floor. Image.Resampling.LANCZOS is the current spelling, and it does not exist before Pillow 9.1; Image.LANCZOS is the same filter, exists in every version the requirement allows, and is still present in the newest release. The agent uses Image.LANCZOS in all four places so the code runs on either side of the upgrade, and leaves the requirement line alone. It checks the other constants in the file too: auto_rotate_by_exif uses Image.ROTATE_180, ROTATE_270 and ROTATE_90, which current Pillow still defines, so they stay. Then it runs an upload-sized JPEG and an RGBA PNG converted to JPEG through save_full_image, requests each of the three resize routes and the default-size route, and opens the files it produced to confirm their dimensions.
Start it with one API call
POST https://api.phoenix.so/o/{org}/sessions with this body:
{
"agent": "claude",
"input": "This project fails with: AttributeError: module 'PIL.Image' has no attribute 'ANTIALIAS'. Fix it without pinning Pillow below 10. Read the dependency files and say which Pillow version a fresh install resolves to and what range the project allows. Find every Image.ANTIALIAS, Image.LINEAR, Image.CUBIC, and every font getsize, getoffset or draw.textsize call, since Pillow 10 removed those together. In a clean virtualenv with the newest Pillow, reproduce the error through the real code paths: call the function that handles an upload with an image you generate in memory, and request each route that resizes through the framework's test client. If a route caches its output on disk, show the behaviour for a size that is already cached and for one that is not. Replace each removed name with the spelling that works across the whole Pillow range the project declares, and say why you chose it over the alternative. Do not change image quality settings, output paths or the cache layout. After the change, run every resizing path again, open each output file and report its dimensions and mode. Do not start a database, nginx or ffmpeg; where a path needs one, say it was not exercised. Open a pull request with the traceback before and the results after.",
"resources": [
{
"url": "https://github.com/your-org/your-app"
}
]
}- Get an API key. In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
- Send the request. POST the body in request.json to https://api.phoenix.so/o/{org}/sessions, with your repository as the resources URL. The run starts in its own cloud sandbox.
- Read what came back. Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.
What comes back
A pull request that changes four lines in two files, image.py and app.py, each Image.ANTIALIAS becoming Image.LANCZOS. The description quotes the traceback, lists the four call sites with the route or function each belongs to, and gives the dimensions of the files written after the fix for one upload and one request to each resize route.
The description also carries the finding about cached sizes, with the two status codes side by side, because it tells the maintainer what to expect in logs: errors only for new sizes and new uploads, starting at the moment the environment was rebuilt. And it flags the except IOError clause in upload() as a follow-up it did not change. Widening it is a separate decision about what an uploader should see when image processing fails.
What the reviewer checks is short. The filter is the same one as before under its real name, so output pixels do not change. The version range in requirements.txt is untouched. The upload route itself is not run end to end, because it opens a PostgreSQL connection before it saves anything, and the description says so.
Run it on every error-tracker issue with this AttributeError
Most teams learn about this from an error tracker. If yours is Sentry, it signs its own webhook requests and cannot send the Authorization: Bearer header that a Rush webhook trigger requires. Run a small handler on your server that receives Sentry's webhook, keeps issues whose title contains has no attribute 'ANTIALIAS', and forwards the payload to the trigger's URL with the trigger's secret. The event text follows the saved prompt, so the agent gets the failing frame without anyone pasting it.
Give the automation a low max_runs_per_hour. One rebuild produces the same error from every route that resizes, and one run fixes all of them.
The use case this job follows, with its automation and trigger: Fix a bug from an alert.
Why run it on Rush?
The edit takes a minute by hand. What takes longer is knowing it is complete: that every route which resizes was exercised on the new Pillow, and that nothing else removed in the same release, such as font.getsize or draw.textsize, is waiting behind it. A laptop virtualenv created two years ago still has Pillow 9 and will pass everything. The sandbox starts from a fresh install, which is the environment that produced the error.
The run also keeps its evidence. The traceback, the test client requests and the dimensions of each output file are in the transcript, so the pull request's claim that all four paths work can be checked against the commands that showed it.
Frequently asked questions
Should I use Image.LANCZOS or Image.Resampling.LANCZOS?
Both name the same filter. Image.Resampling.LANCZOS exists only from Pillow 9.1 on, so it breaks older environments. Image.LANCZOS works on old and new releases alike. The agent reads the version range your project declares and picks the spelling that works across all of it.
Will my thumbnails look different?
No. ANTIALIAS was another name for the Lanczos filter, so the resampling is identical. Files your application already wrote to disk are not regenerated either.
Why do some images still load when others fail?
An application that caches resized files serves the cached ones without calling Pillow. Only a size or an upload that needs a new resize reaches the removed name. The agent shows both cases so the pattern in your logs makes sense.
I also get "'FreeTypeFont' object has no attribute 'getsize'". Is that the same upgrade?
Yes, Pillow 10 removed getsize and textsize in the same release. The prompt has the agent search for them. The replacements are font.getbbox() and draw.textbbox(), which return a box instead of a width and height, so the agent adjusts the arithmetic around each call and renders a sample to compare.