[GH-ISSUE #4310] [Issue]: Noodle refresh sends corrupt ComfyUI/gallery images to OpenAI instead of skipping them #2331

Closed
opened 2026-10-21 05:47:21 +07:00 by bsakaguchi · 2 comments
Owner

Originally created by @thetopham on GitHub (Jul 30, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/4310

Originally assigned to: @SpicyMarinara on GitHub.

Summary

When a recent Noodle post contains a broken/corrupt local gallery image associated with the configured ComfyUI-backed image connection, Noodle retries the undecodable bytes through image captioning and then through the main OpenAI timeline request. OpenAI rejects the attachment as an invalid image, the timeline refresh returns 500, and the automatic scheduler keeps retrying.

At the reported repro, the local ComfyUI endpoint was not running/open and Noodle displayed broken image links. The logs prove that the affected post already referenced a locally persisted PNG that Sharp could not decode; they do not prove that endpoint downtime was the original moment the file became corrupt. The Engine bug is reproducible from the persisted invalid-image state even without another ComfyUI request.

Expected behavior

  • If ComfyUI is unavailable or returns invalid media, Noodle should not persist or attach a broken image URL/file.
  • If an existing timeline/gallery image cannot be decoded, Noodle should skip that image (and mark it unavailable/not attached) while continuing the text-only timeline refresh.
  • A failure to caption one image must not promote the same invalid bytes into the main multimodal request or fail the entire feed refresh.

Actual behavior

The affected post is marked as image-generated with model krea2 and references a local character-gallery PNG. The file exists and has a PNG signature, but Sharp rejects its contents with pngload_buffer: libspng read error.

The current path then:

  1. Accepts the file based on its PNG magic bytes.
  2. Catches Sharp's decode failure and returns the original sub-8 MiB buffer as a data URL.
  3. Sends that invalid data URL to the configured image-captioning provider.
  4. Receives OpenAI 400: The image data you provided does not represent a valid image.
  5. Treats the failed caption as an image that still needs direct vision input.
  6. Sends the same invalid image in the main Noodle generation request, which receives the same 400 and makes the refresh return 500.

From 2026-07-29 22:00 MDT through 2026-07-30 12:48 MDT, the journal contained 18 Sharp optimization failures, 16 matching invalid-image caption failures for the same post, and 18 invalid-image timeline refresh failures.

Steps to reproduce

  1. Run Marinara Engine from staging with Noodle generation using an OpenAI connection and Noodle image generation using a local/private ComfyUI-backed connection.
  2. Use the failure-time Noodle settings listed below, especially image prompts enabled, gallery attachments enabled, and image captioning enabled.
  3. Leave/introduce a Noodle post whose local gallery image has a valid PNG signature but corrupt/undecodable contents. The reported user path was a ComfyUI-backed image while the local ComfyUI endpoint was not running/open, leaving a broken image in the feed.
  4. Trigger an automatic or manual public Noodle timeline refresh.
  5. Observe Sharp reject the timeline image, OpenAI reject it during image captioning, and the main timeline request fail with the same invalid-image 400.

Noodle settings at failure time

Snapshot captured before image captioning was toggled off as a temporary workaround:

  • refreshesPerDay: 2
  • participantSelectionMode: all
  • participantMin: 15
  • participantMax: 20
  • maxGeneratedPostsPerRefresh: 20
  • maxRepliesPerRefresh: 5
  • maxRepostsPerRefresh: 0
  • maxLikesPerRefresh: 17
  • maxImagesPerRefresh: 25
  • enableImagePrompts: true
  • imageGenerationConnectionId: configured connection krea2 (image_generation, service comfyui, private/local endpoint; URL and internal ID omitted)
  • imageGenerationPrompt: Create either a social-media-ready character image or an in-character meme for the post. For character images, mention build, clothing, visible appearance, pose, expression, setting, lighting, mood, and composition. For memes, mention meme format, visual gag, composition, and short readable caption/text when relevant.
  • imageGenerationUseAvatarReferences: false
  • imageGenerationIncludeDescriptions: false
  • allowGalleryImageAttachments: true
  • imageCaptioningEnabled: true
  • imageCaptioningConnectionId: null
  • imageCaptioningUseConnectionDefault: false
  • Effective captioning connection: Noodle's fallback generation connection, gpt-5.6-sol via openai_chatgpt
  • enableLorebookContext: false
  • includeCharacterSchedules: false
  • enableEnhancedTimelineWriting: true
  • allowProfessorMari: false
  • allowRandomUsers: false
  • invitedCharacterGroupIds: []
  • Individually invited character accounts present during investigation: 21 (names omitted)
  • carryoverMode: conversation
  • carryoverModes: [conversation]
  • carryoverHours: 48
  • carryoverMaxItems: 8
  • theme: system
  • generationConnectionId: configured connection gpt-5.6-sol (openai_chatgpt; internal ID omitted)
  • enableNoodler: false
  • noodlerGenerationGuidance: shipped default adult-platform guidance
  • Stored compatibility alias privateGenerationGuidance: same value as noodlerGenerationGuidance
  • autoPostingScheduleEnabled: true
  • autoPostingDefaultIntensity: 1
  • reviewImagePromptsBeforeSend: omitted/false on the failing automatic scheduler path

Environment

  • Marinara Engine version: 2.3.5, staging commit 571a76684f0d569d577919c39405344a7c184841
  • Install type: source checkout, user marinara.service
  • OS + version: Ubuntu 24.04.4 LTS, Linux 6.8.0-136-generic x86_64
  • Browser or app shell: Noodle web UI; exact browser was not captured
  • Image generation: krea2 using the ComfyUI service against a private/local endpoint; endpoint not running/open at repro (user-reported)
  • Noodle/text + effective captioning provider: gpt-5.6-sol via openai_chatgpt

Logs, screenshots, or video

Representative journal sequence (post ID redacted):

2026-07-30T07:40:51-06:00 [noodle/vision] Failed to optimize a timeline image
  pngload_buffer: libspng read error

2026-07-30T07:40:57-06:00 [image-captioning] Failed to caption image attachment noodle-post-image:<redacted>
  OpenAI Responses API error 400: The image data you provided does not represent a valid image. Please check your input and try again.

2026-07-30T07:41:21-06:00 [noodle] Timeline refresh failed
  OpenAI Responses API error 400: The image data you provided does not represent a valid image. Please check your input and try again.

2026-07-30T07:41:21-06:00 [noodle-scheduler] Automatic refresh failed with status 500; retrying

Relevant stack path:

optimizeNoodleVisionImage
prepareNoodleVisionAttachments
buildRefreshPrompt
generateImageCaptionForDataUrl
generateImageCaptionsForDataUrls
public Noodle generation
POST /api/noodle/refresh

Additional context

This is Engine-owned host integration: the failing code is in Noodle vision preparation, shared image captioning, provider request shaping, and the public Noodle generation service.

Source-level cause at the inspected commit:

  • packages/server/src/services/noodle/noodle-vision.ts: after Sharp throws, optimizeNoodleVisionImage returns the original buffer whenever it is under the unoptimized-size threshold.
  • packages/server/src/services/generation/image-captioning-runtime.ts: a caption failure returns null.
  • packages/server/src/services/noodle/noodle-public-prompt.service.ts: a null caption puts the attachment back into visionAttachments, so the invalid bytes are sent again in the main request.

The exact post text, character identity, private endpoint URL, connection IDs, and API credentials are intentionally omitted. Turning image captioning off was attempted after the captured settings snapshot, but it does not repair the invalid stored image or the raw-buffer fallback.

No matching issue, PR, or issue-linked branch was found for this failure. No implementation owner is assigned and no code work has started.

Template check

Please uncheck (untick) the box below before submitting so we know you read the template. It is intentionally pre-checked:

  • I DID NOT read this template and provide the requested details.
Originally created by @thetopham on GitHub (Jul 30, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/4310 Originally assigned to: @SpicyMarinara on GitHub. ## Summary When a recent Noodle post contains a broken/corrupt local gallery image associated with the configured ComfyUI-backed image connection, Noodle retries the undecodable bytes through image captioning and then through the main OpenAI timeline request. OpenAI rejects the attachment as an invalid image, the timeline refresh returns 500, and the automatic scheduler keeps retrying. At the reported repro, the local ComfyUI endpoint was not running/open and Noodle displayed broken image links. The logs prove that the affected post already referenced a locally persisted PNG that Sharp could not decode; they do not prove that endpoint downtime was the original moment the file became corrupt. The Engine bug is reproducible from the persisted invalid-image state even without another ComfyUI request. ## Expected behavior - If ComfyUI is unavailable or returns invalid media, Noodle should not persist or attach a broken image URL/file. - If an existing timeline/gallery image cannot be decoded, Noodle should skip that image (and mark it unavailable/not attached) while continuing the text-only timeline refresh. - A failure to caption one image must not promote the same invalid bytes into the main multimodal request or fail the entire feed refresh. ## Actual behavior The affected post is marked as image-generated with model `krea2` and references a local character-gallery PNG. The file exists and has a PNG signature, but Sharp rejects its contents with `pngload_buffer: libspng read error`. The current path then: 1. Accepts the file based on its PNG magic bytes. 2. Catches Sharp's decode failure and returns the original sub-8 MiB buffer as a data URL. 3. Sends that invalid data URL to the configured image-captioning provider. 4. Receives OpenAI 400: `The image data you provided does not represent a valid image.` 5. Treats the failed caption as an image that still needs direct vision input. 6. Sends the same invalid image in the main Noodle generation request, which receives the same 400 and makes the refresh return 500. From 2026-07-29 22:00 MDT through 2026-07-30 12:48 MDT, the journal contained 18 Sharp optimization failures, 16 matching invalid-image caption failures for the same post, and 18 invalid-image timeline refresh failures. ## Steps to reproduce 1. Run Marinara Engine from `staging` with Noodle generation using an OpenAI connection and Noodle image generation using a local/private ComfyUI-backed connection. 2. Use the failure-time Noodle settings listed below, especially image prompts enabled, gallery attachments enabled, and image captioning enabled. 3. Leave/introduce a Noodle post whose local gallery image has a valid PNG signature but corrupt/undecodable contents. The reported user path was a ComfyUI-backed image while the local ComfyUI endpoint was not running/open, leaving a broken image in the feed. 4. Trigger an automatic or manual public Noodle timeline refresh. 5. Observe Sharp reject the timeline image, OpenAI reject it during image captioning, and the main timeline request fail with the same invalid-image 400. ### Noodle settings at failure time Snapshot captured before image captioning was toggled off as a temporary workaround: - `refreshesPerDay`: `2` - `participantSelectionMode`: `all` - `participantMin`: `15` - `participantMax`: `20` - `maxGeneratedPostsPerRefresh`: `20` - `maxRepliesPerRefresh`: `5` - `maxRepostsPerRefresh`: `0` - `maxLikesPerRefresh`: `17` - `maxImagesPerRefresh`: `25` - `enableImagePrompts`: `true` - `imageGenerationConnectionId`: configured connection `krea2` (`image_generation`, service `comfyui`, private/local endpoint; URL and internal ID omitted) - `imageGenerationPrompt`: `Create either a social-media-ready character image or an in-character meme for the post. For character images, mention build, clothing, visible appearance, pose, expression, setting, lighting, mood, and composition. For memes, mention meme format, visual gag, composition, and short readable caption/text when relevant.` - `imageGenerationUseAvatarReferences`: `false` - `imageGenerationIncludeDescriptions`: `false` - `allowGalleryImageAttachments`: `true` - `imageCaptioningEnabled`: `true` - `imageCaptioningConnectionId`: `null` - `imageCaptioningUseConnectionDefault`: `false` - Effective captioning connection: Noodle's fallback generation connection, `gpt-5.6-sol` via `openai_chatgpt` - `enableLorebookContext`: `false` - `includeCharacterSchedules`: `false` - `enableEnhancedTimelineWriting`: `true` - `allowProfessorMari`: `false` - `allowRandomUsers`: `false` - `invitedCharacterGroupIds`: `[]` - Individually invited character accounts present during investigation: `21` (names omitted) - `carryoverMode`: `conversation` - `carryoverModes`: `[conversation]` - `carryoverHours`: `48` - `carryoverMaxItems`: `8` - `theme`: `system` - `generationConnectionId`: configured connection `gpt-5.6-sol` (`openai_chatgpt`; internal ID omitted) - `enableNoodler`: `false` - `noodlerGenerationGuidance`: shipped default adult-platform guidance - Stored compatibility alias `privateGenerationGuidance`: same value as `noodlerGenerationGuidance` - `autoPostingScheduleEnabled`: `true` - `autoPostingDefaultIntensity`: `1` - `reviewImagePromptsBeforeSend`: omitted/`false` on the failing automatic scheduler path ## Environment - Marinara Engine version: 2.3.5, `staging` commit `571a76684f0d569d577919c39405344a7c184841` - Install type: source checkout, user `marinara.service` - OS + version: Ubuntu 24.04.4 LTS, Linux 6.8.0-136-generic x86_64 - Browser or app shell: Noodle web UI; exact browser was not captured - Image generation: `krea2` using the ComfyUI service against a private/local endpoint; endpoint not running/open at repro (user-reported) - Noodle/text + effective captioning provider: `gpt-5.6-sol` via `openai_chatgpt` ## Logs, screenshots, or video Representative journal sequence (post ID redacted): ```text 2026-07-30T07:40:51-06:00 [noodle/vision] Failed to optimize a timeline image pngload_buffer: libspng read error 2026-07-30T07:40:57-06:00 [image-captioning] Failed to caption image attachment noodle-post-image:<redacted> OpenAI Responses API error 400: The image data you provided does not represent a valid image. Please check your input and try again. 2026-07-30T07:41:21-06:00 [noodle] Timeline refresh failed OpenAI Responses API error 400: The image data you provided does not represent a valid image. Please check your input and try again. 2026-07-30T07:41:21-06:00 [noodle-scheduler] Automatic refresh failed with status 500; retrying ``` Relevant stack path: ```text optimizeNoodleVisionImage prepareNoodleVisionAttachments buildRefreshPrompt generateImageCaptionForDataUrl generateImageCaptionsForDataUrls public Noodle generation POST /api/noodle/refresh ``` ## Additional context This is Engine-owned host integration: the failing code is in Noodle vision preparation, shared image captioning, provider request shaping, and the public Noodle generation service. Source-level cause at the inspected commit: - `packages/server/src/services/noodle/noodle-vision.ts`: after Sharp throws, `optimizeNoodleVisionImage` returns the original buffer whenever it is under the unoptimized-size threshold. - `packages/server/src/services/generation/image-captioning-runtime.ts`: a caption failure returns `null`. - `packages/server/src/services/noodle/noodle-public-prompt.service.ts`: a `null` caption puts the attachment back into `visionAttachments`, so the invalid bytes are sent again in the main request. The exact post text, character identity, private endpoint URL, connection IDs, and API credentials are intentionally omitted. Turning image captioning off was attempted after the captured settings snapshot, but it does not repair the invalid stored image or the raw-buffer fallback. No matching issue, PR, or issue-linked branch was found for this failure. No implementation owner is assigned and no code work has started. ## Template check Please **uncheck (untick)** the box below before submitting so we know you read the template. It is intentionally pre-checked: - [ ] I DID NOT read this template and provide the requested details.
bsakaguchi 2026-10-21 05:47:21 +07:00
Author
Owner

@SpicyMarinara commented on GitHub (Jul 30, 2026):

Claimed by @SpicyMarinara in draft PR #4322. The implementation will stay narrow: reject undecodable Noodle images before captioning or multimodal attachment, then prove the refresh can continue text-only.

<!-- gh-comment-id:5137470271 --> @SpicyMarinara commented on GitHub (Jul 30, 2026): Claimed by @SpicyMarinara in draft PR #4322. The implementation will stay narrow: reject undecodable Noodle images before captioning or multimodal attachment, then prove the refresh can continue text-only.
Author
Owner

@SpicyMarinara commented on GitHub (Jul 31, 2026):

Fixed in #4322 and merged into staging as 9bc60818d. Corrupt or undecodable timeline images are now skipped before captioning/multimodal generation so Noodle refresh can continue text-only.

<!-- gh-comment-id:5137763755 --> @SpicyMarinara commented on GitHub (Jul 31, 2026): Fixed in #4322 and merged into `staging` as 9bc60818d. Corrupt or undecodable timeline images are now skipped before captioning/multimodal generation so Noodle refresh can continue text-only.
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#2331
No description provided.