[GH-ISSUE #912] [Issue]: Large image uploads can deadlock replies with OpenAI 413 payload errors #445

Closed
opened 2026-10-20 17:28:57 +07:00 by bsakaguchi · 2 comments
Owner

Originally created by @cha1latte on GitHub (May 16, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/912

Originally assigned to: @SpicyMarinara on GitHub.

Summary

Sending a large uploaded image into chat can deadlock the assistant reply path when the model starts responding to the picture. The OpenAI API returns a request-size failure instead of the app resizing or otherwise handling the upload safely.

Expected behavior

Uploaded images should be resized/compressed before they are sent to the AI provider, or the app should reject/handle oversized images before generation starts. The assistant should not get stuck when replying to an image message.

Actual behavior

When the AI attempts to start writing a reply to the uploaded picture, the request fails with:

OpenAI API error 413: Request Entity Too Large
FUNCTION_PAYLOAD_TOO_LARGE

The user described this as a total deadlock.

Steps to reproduce

  1. Upload a large image in chat.
  2. Send the image to an AI character/provider backed by OpenAI.
  3. Wait for the assistant to start replying to the picture.
  4. See the API error toast/report instead of a reply.

Marinara Engine version

Not specified; has happened across versions and still occurs in newest.

Install type

Has occurred on a variety of installs.

OS + version

Definitely happens at least on Windows.

Browser or app shell

Not specified.

Screenshots or video

Image

Logs

OpenAI API error 413: Request Entity Too Large
FUNCTION_PAYLOAD_TOO_LARGE

Additional context

Reporter suggested adding image resizing on upload to prevent oversized image payloads from reaching the provider and deadlocking the reply attempt.

Originally created by @cha1latte on GitHub (May 16, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/912 Originally assigned to: @SpicyMarinara on GitHub. ## Summary Sending a large uploaded image into chat can deadlock the assistant reply path when the model starts responding to the picture. The OpenAI API returns a request-size failure instead of the app resizing or otherwise handling the upload safely. ## Expected behavior Uploaded images should be resized/compressed before they are sent to the AI provider, or the app should reject/handle oversized images before generation starts. The assistant should not get stuck when replying to an image message. ## Actual behavior When the AI attempts to start writing a reply to the uploaded picture, the request fails with: ```text OpenAI API error 413: Request Entity Too Large FUNCTION_PAYLOAD_TOO_LARGE ``` The user described this as a total deadlock. ## Steps to reproduce 1. Upload a large image in chat. 2. Send the image to an AI character/provider backed by OpenAI. 3. Wait for the assistant to start replying to the picture. 4. See the API error toast/report instead of a reply. ## Marinara Engine version Not specified; has happened across versions and still occurs in newest. ## Install type Has occurred on a variety of installs. ## OS + version Definitely happens at least on Windows. ## Browser or app shell Not specified. ## Screenshots or video <img width="696" height="406" alt="Image" src="https://github.com/user-attachments/assets/2b9ec90f-d277-4b84-a130-abe08814f2e0" /> ## Logs ```text OpenAI API error 413: Request Entity Too Large FUNCTION_PAYLOAD_TOO_LARGE ``` ## Additional context Reporter suggested adding image resizing on upload to prevent oversized image payloads from reaching the provider and deadlocking the reply attempt.
bsakaguchi 2026-10-20 17:28:57 +07:00
Author
Owner

@SpicyMarinara commented on GitHub (May 17, 2026):

Fixing.

<!-- gh-comment-id:4470099120 --> @SpicyMarinara commented on GitHub (May 17, 2026): Fixing.
Author
Owner

@SpicyMarinara commented on GitHub (May 17, 2026):

Fixed on staging in d517e577: chat image attachments are now compressed before generation and provider-bound oversized image data URLs are capped so OpenAI 413 payload errors no longer deadlock replies.

<!-- gh-comment-id:4470168993 --> @SpicyMarinara commented on GitHub (May 17, 2026): Fixed on staging in d517e577: chat image attachments are now compressed before generation and provider-bound oversized image data URLs are capped so OpenAI 413 payload errors no longer deadlock replies.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#445
No description provided.