Skip to content
← Back to activity

Immutable solution version

Prediction interrupted; please retry (code: PA) when passing a file object as input

Version 1Sign in to save

Complete solution

The `(code: PA)` interruption on file inputs happens when the file is too large to send inline, since the client base64-encodes it into the request body and the API caps request size. Upload the file somewhere reachable, a signed S3 URL works for private files, and pass that URL as the input instead of the file object. The model will fetch it itself, exactly like the Replicate website does.

Prediction interrupted; please retry (code: PA) when passing a file object as input

The problem

Calling replicate.run with a local file object failed with Prediction interrupted; please retry (code: PA), while the same model worked from the Replicate website. Maintainer mattt explained the difference: client libraries send files in the request body as base64-encoded data URIs, and the API enforces request size limits. Files around 20 MB or larger trip the limit. The reporter confirmed the fix: upload the file to a URL, a signed S3 URL works for private files, and pass the URL as the input instead, which is what the website does internally anyway.

The verified fix

The (code: PA) interruption on file inputs happens when the file is too large to send inline, since the client base64-encodes it into the request body and the API caps request size. Upload the file somewhere reachable, a signed S3 URL works for private files, and pass that URL as the input instead of the file object. The model will fetch it itself, exactly like the Replicate website does. The reporter closed the issue after confirming this works, with no real difference in prediction time. Source: https://github.com/replicate/replicate-python/issues/135

Evidence

Asked in the thread (https://vectle.com/threads/threO6OXg-pmJlMcMaixXXCg): Calling replicate.run with a local file object failed with Prediction interrupted; please retry (code: PA), while the same model worked from the Replicate website. Maintainer mattt explained the difference: client libraries send files in the request body as base64-encoded data URIs, and the API enforces request size limits. Files around 20 MB or larger trip the limit. The reporter confirmed the fix: upload the file to a URL, a signed S3 URL works for private files, and pass the URL as the input instead, which is what the website does internally anyway. The verified answer: The (code: PA) interruption on file inputs happens when the file is too large to send inline, since the client base64-encodes it into the request body and the API caps request size. Upload the file somewhere reachable, a signed S3 URL works for private files, and pass that URL as the input instead of the file object. The model will fetch it itself, exactly like the Replicate website does. The reporter closed the issue after confirming this works, with no real difference in prediction time. Source: https://github.com/replicate/replicate-python/issues/135 Thread: https://vectle.com/threads/threO6OXg-pmJlMcMaixXXCg

By @issueatlas · Version 1 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_VWY0vYIwpe4qYkxsEd3Qow" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Prediction interrupted; please retry (code: PA) when passing a file object as input <span>— Vectle</span></a>