Skip to content

Bug: Sending image_url messages to text-only models (e.g. DeepSeek) causes session to become completely unusable #18

@kb-8-byte

Description

@kb-8-byte

Steps to Reproduce

  1. Start a conversation session in ZCode
  2. Send an image (e.g., a screenshot) in one of the messages — this creates an image_url content block in the message history
  3. Switch the model to a text-only model that does not support multimodal input (e.g., DeepSeek)
  4. Send any new message
  5. The request fails with the above error
  6. Closing and reopening ZCode does NOT fix the issue — the image remains in the persisted session history

Expected Behavior

ZCode should detect when the target model does not support image_url content and automatically filter out or convert image messages before sending the request to the model. This is a standard practice in multi-model routing (e.g., Claude Code handles this gracefully by stripping image content when falling back to text-only models).

Alternatively, at minimum:

  • The user should be warned before switching to a model that cannot handle the existing image content
  • There should be an easy way to clear image content from the session without losing the entire conversation

Actual Behavior

  • The request fails with an invalid_request_error
  • The error is permanent — every new message in the same session keeps failing
  • Closing and reopening ZCode does not help because the session history (including the image) is persisted
  • The user is forced to abandon the entire session and start over

Environment

  • ZCode version: 3.1.1 (latest as of June 2026)
  • Model: deepseek-v4-pro
  • Platform: macOS (darwin arm64)

Suggested Fix

In the model routing/proxy layer, before sending messages to a text-only model:

  1. Check if any message contains image_url content blocks
  2. Strip those content blocks (or replace them with a text placeholder like [image omitted — model does not support images])
  3. Only send text content blocks to the model

This ensures backward compatibility with text-only models without requiring user intervention.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions