[GH-ISSUE #8470] [Issue]: Roleplay generation fails with HTTP 500 when lorebook entries contain images and the roleplay model does not accept images #8369

Closed
opened 2026-11-07 16:42:31 +07:00 by bsakaguchi · 3 comments
Owner

Originally created by @minouris on GitHub (Oct 29, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/8470

Originally assigned to: @SpicyMarinara on GitHub.

Summary

When a lorebook entry has attached images, the engine injects them as visual references into the roleplay generation prompt and sends them to the roleplay model. If the roleplay model does not accept images, the endpoint returns HTTP 500 "image input is not supported". LorebookImageProvider only treats HTTP 400/415/422 as recoverable image-incompatibility, so the 500 propagates and the entire generation fails instead of skipping the images and continuing.

Expected behavior

For a non-vision roleplay model, lorebook reference images should be skipped and generation should continue, with the imagesUnsupportedModelNotice surfaced to the UI (as the feature already intends), regardless of whether the endpoint reports the incompatibility as 400, 415, 422, or 500.

Actual behavior

Generation fails with LLMHttpError (status 500) and no response is produced. The chat's generation is aborted. The issue reproduces across multiple consecutive generation attempts.

Steps to reproduce

  1. Configure a roleplay connection pointing at a text-only (non-vision) OpenAI-compatible endpoint (one that rejects image inputs).
  2. Attach one or more images to a lorebook entry that activates during a roleplay generation.
  3. Trigger a roleplay generation in a chat where that lorebook entry is scanned.
  4. Observe generation fails with "Custom OpenAI-compatible endpoint error 500: image input is not supported".

Environment

  • Marinara Engine version: v2.5.0 / v2.5.1 (lorebook visual-reference feature present since v2.5.0)
  • Install type: docker
  • OS + version: (not specified)
  • Browser or app shell: web client

Logs, screenshots, or video

Relevant error (prompt content omitted):

LLMHttpError: Custom OpenAI-compatible endpoint error 500: image input is not supported - hint: if this is unexpected, you may need to provide the mmproj
  at llmHttpErrorFromResponse (base-provider.js:153)
  at OpenAIProvider.completionHttpError (openai.provider.js:803)
  at OpenAIProvider.postChatCompletions (openai.provider.js:900)
  at OpenAIProvider.chatCompleteOnce (openai.provider.js:1984)
  at LorebookImageProvider.chatComplete (lorebook-image-provider.js:67)
  at withConnectionAdmission (connection-admission.js:148)
  at RateLimitAwareProvider.chatComplete (rate-limit-aware-provider.js:282)
  at runToolRounds (tool-rounds.js:95)
  at generateForCharacter (generate.routes.js:7247)

Additional context

  • The lorebook visual-reference-image feature is new (introduced in v2.5.0); before it, lorebook entries carried no images and nothing image-bearing was sent to the roleplay model.
  • Root cause: isImageInputUnsupported() in packages/server/src/services/llm/lorebook-image-provider.ts only recognises HTTP 400/415/422. A text-only endpoint served by llama.cpp reports the same condition as HTTP 500, so the wrapper never enters its text-only retry path.
  • Suggested fix: extend isImageInputUnsupported() to also treat an HTTP 500 whose message indicates image input is not supported (e.g. "image input is not supported" / "provide the mmproj") as recoverable, so the existing graceful-skip path fires for llama.cpp-backed endpoints.
  • Workaround until fixed: remove images from the affected lorebook entries, or use a vision-capable roleplay model.

Template check

  • I DID NOT read this template and provide the requested details.
Originally created by @minouris on GitHub (Oct 29, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/8470 Originally assigned to: @SpicyMarinara on GitHub. ## Summary When a lorebook entry has attached images, the engine injects them as visual references into the roleplay generation prompt and sends them to the roleplay model. If the roleplay model does not accept images, the endpoint returns HTTP 500 "image input is not supported". `LorebookImageProvider` only treats HTTP 400/415/422 as recoverable image-incompatibility, so the 500 propagates and the entire generation fails instead of skipping the images and continuing. ## Expected behavior For a non-vision roleplay model, lorebook reference images should be skipped and generation should continue, with the `imagesUnsupportedModelNotice` surfaced to the UI (as the feature already intends), regardless of whether the endpoint reports the incompatibility as 400, 415, 422, or 500. ## Actual behavior Generation fails with `LLMHttpError` (status 500) and no response is produced. The chat's generation is aborted. The issue reproduces across multiple consecutive generation attempts. ## Steps to reproduce 1. Configure a roleplay connection pointing at a text-only (non-vision) OpenAI-compatible endpoint (one that rejects image inputs). 2. Attach one or more images to a lorebook entry that activates during a roleplay generation. 3. Trigger a roleplay generation in a chat where that lorebook entry is scanned. 4. Observe generation fails with "Custom OpenAI-compatible endpoint error 500: image input is not supported". ## Environment - Marinara Engine version: v2.5.0 / v2.5.1 (lorebook visual-reference feature present since v2.5.0) - Install type: docker - OS + version: (not specified) - Browser or app shell: web client ## Logs, screenshots, or video Relevant error (prompt content omitted): ``` LLMHttpError: Custom OpenAI-compatible endpoint error 500: image input is not supported - hint: if this is unexpected, you may need to provide the mmproj at llmHttpErrorFromResponse (base-provider.js:153) at OpenAIProvider.completionHttpError (openai.provider.js:803) at OpenAIProvider.postChatCompletions (openai.provider.js:900) at OpenAIProvider.chatCompleteOnce (openai.provider.js:1984) at LorebookImageProvider.chatComplete (lorebook-image-provider.js:67) at withConnectionAdmission (connection-admission.js:148) at RateLimitAwareProvider.chatComplete (rate-limit-aware-provider.js:282) at runToolRounds (tool-rounds.js:95) at generateForCharacter (generate.routes.js:7247) ``` ## Additional context - The lorebook visual-reference-image feature is new (introduced in v2.5.0); before it, lorebook entries carried no images and nothing image-bearing was sent to the roleplay model. - Root cause: `isImageInputUnsupported()` in `packages/server/src/services/llm/lorebook-image-provider.ts` only recognises HTTP 400/415/422. A text-only endpoint served by llama.cpp reports the same condition as HTTP 500, so the wrapper never enters its text-only retry path. - Suggested fix: extend `isImageInputUnsupported()` to also treat an HTTP 500 whose message indicates image input is not supported (e.g. "image input is not supported" / "provide the mmproj") as recoverable, so the existing graceful-skip path fires for llama.cpp-backed endpoints. - Workaround until fixed: remove images from the affected lorebook entries, or use a vision-capable roleplay model. ## Template check - [ ] I DID NOT read this template and provide the requested details.
bsakaguchi 2026-11-07 16:42:31 +07:00
Author
Owner

@minouris commented on GitHub (Oct 29, 2026):

For completeness, the llama.cpp image is this one: https://github.com/agenticsnz/llama.cpp-rocm-docker

<!-- gh-comment-id:6508155030 --> @minouris commented on GitHub (Oct 29, 2026): For completeness, the llama.cpp image is this one: https://github.com/agenticsnz/llama.cpp-rocm-docker
Author
Owner

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

@SpicyMarinara requested an end-to-end sweep of assigned issues. Codex is taking ownership of the explicit unsupported-image HTTP 500 fallback. I checked the open PRs and issue-linked work before starting; a draft PR will make implementation progress visible. The fix will target staging, pass the repository validation and review gates, and this issue will close only after the resolved behavior is delivered.

<!-- gh-comment-id:6511802373 --> @SpicyMarinara commented on GitHub (Oct 30, 2026): @SpicyMarinara requested an end-to-end sweep of assigned issues. Codex is taking ownership of the explicit unsupported-image HTTP 500 fallback. I checked the open PRs and issue-linked work before starting; a draft PR will make implementation progress visible. The fix will target staging, pass the repository validation and review gates, and this issue will close only after the resolved behavior is delivered.
Author
Owner

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

Resolved on staging by #8484 (merge c619aca012). An explicit unsupported-image HTTP 500 now uses the existing text-only retry for lorebook reference images and retains the skipped-image notice. User attachments are preserved; unrelated 500 errors, partial streams, aborts, and failures without removable references do not retry. The focused stream/non-stream regression matrix, prompt regressions, pnpm check, local CodeRabbit review, required PR checks, and final-head Dottore review passed. Post-merge staging checks are separate.

<!-- gh-comment-id:6512411239 --> @SpicyMarinara commented on GitHub (Oct 30, 2026): Resolved on staging by #8484 (merge c619aca012a825573ad2f1e6c7c13c046e6bfa92). An explicit unsupported-image HTTP 500 now uses the existing text-only retry for lorebook reference images and retains the skipped-image notice. User attachments are preserved; unrelated 500 errors, partial streams, aborts, and failures without removable references do not retry. The focused stream/non-stream regression matrix, prompt regressions, pnpm check, local CodeRabbit review, required PR checks, and final-head Dottore review passed. Post-merge staging checks are separate.
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#8369
No description provided.