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

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

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

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/8471 ## 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.
Author
Owner

@coderabbitai[bot] commented on GitHub (Oct 29, 2026):

⚠️ Possible Duplicate Issue(s)

📝 Issue Planner

Check the box below or use the @coderabbitai plan command to generate an implementation plan and prompts that you can use with your favorite coding assistant.

  • Create Plan

🧪 Issue enrichment is currently in open beta.

You can configure auto-planning by selecting labels in the issue_enrichment configuration.

To disable automatic issue enrichment, add the following to your .coderabbit.yaml:

issue_enrichment:
  auto_enrich:
    enabled: false

💬 Have feedback or questions? Drop into our discord!

<!-- gh-comment-id:6507705882 --> @coderabbitai[bot] commented on GitHub (Oct 29, 2026): <!-- coderabbit-ai-generated:v1 --> <!-- This is an auto-generated issue plan by CodeRabbit --> <details> <summary>⚠️ Possible Duplicate Issue(s)</summary> <dl> <dd> - https://github.com/Pasta-Devs/Marinara-Engine/issues/8470 </dd> </dl> </details> --- <details> <summary>📝 Issue Planner</summary> <dl> <dd> <sub>Check the box below or use the `@coderabbitai plan` command to generate an implementation plan and prompts that you can use with your favorite coding assistant.</sub> - [ ] <!-- {"checkboxId":"8d4f2b9c-3e1a-4f7c-a9b2-d5e8f1c4a7b9"} --> Create Plan </dd> </dl> </details> --- <details> <summary> 🧪 Issue enrichment is currently in open beta.</summary> <dl> <dd> You can configure auto-planning by selecting labels in the issue_enrichment configuration. To disable automatic issue enrichment, add the following to your `.coderabbit.yaml`: ```yaml issue_enrichment: auto_enrich: enabled: false ``` </dd> </dl> </details> 💬 Have feedback or questions? Drop into our [discord](https://discord.gg/coderabbit)!
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#8368
No description provided.