Skip to content

[BUG] Chat crashes with image update - Claude #20

@CiscoTheKid

Description

@CiscoTheKid

Steps to Reproduce

1.Open any chat
2.start typing and send message
3.Send another message with Only picture in the message. No other content.

What Happened

Was prepping sapphire for a image. Gave context about image. Said hang on. Then dropped image into chat. Sent image with no other text in the chat
Crashed with error. Had to edit message and enter text into it and send WITH image data.

What You Expected

Send image data solo

System Info

  • OS / Distro: KUBUNTU 25.10
  • CPU:
  • RAM:
  • GPU / VRAM:
  • Sapphire version / commit:
  • LLM backend (e.g. QWQ32B, Qwen3, Claude): Claude Opus latest release

Logs

026-03-12 00:00:52,450 - core.chat.llm_providers.claude - INFO - [THINK] Bumped max_tokens to 18000 (must exceed budget)
2026-03-12 00:00:52,450 - core.chat.llm_providers.claude - INFO - [THINK] Claude extended thinking enabled (budget: 10000)
2026-03-12 00:00:52,450 - core.chat.llm_providers.claude - INFO - [CACHE] Tool caching active on last tool (TTL: 1h)
2026-03-12 00:00:52,656 - httpx - INFO - HTTP Request: POST https://api.anthropic.com/v1/messages "HTTP/1.1 400 Bad Request"
2026-03-12 00:00:52,656 - core.chat.chat_streaming - ERROR - [ERR] [STREAMING] Iteration 1 failed: Error code: 400 - {'type': 'error', 'error': {'type': 'invalid_request_error', 'message': 'messages: text content blocks must be non-empty'}, 'request_id': 'req_011CYxX3cFe7dQKDQGmVa51i'}
Traceback (most recent call last):
  File "/home/cisco/projects/sapphire/core/chat/chat_streaming.py", line 211, in chat_stream
    for event in self.current_stream:
  File "/home/cisco/projects/sapphire/core/chat/llm_providers/claude.py", line 365, in chat_completion_stream
    with stream_ctx as stream:
  File "/home/cisco/miniconda3/envs/sapphire/lib/python3.11/site-packages/anthropic/lib/streaming/_messages.py", line 167, in __enter__
    raw_stream = self.__api_request()
                 ^^^^^^^^^^^^^^^^^^^^
  File "/home/cisco/miniconda3/envs/sapphire/lib/python3.11/site-packages/anthropic/_base_client.py", line 1364, in post
    return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/cisco/miniconda3/envs/sapphire/lib/python3.11/site-packages/anthropic/_base_client.py", line 1137, in request
    raise self._make_status_error_from_response(err.response) from None
anthropic.BadRequestError: Error code: 400 - {'type': 'error', 'error': {'type': 'invalid_request_error', 'message': 'messages: text content blocks must be non-empty'}, 'request_id': 'req_011CYxX3cFe7dQKDQGmVa51i'}
2026-03-12 00:00:52,657 - core.chat.chat_streaming - INFO - [CLEANUP] Stream closed
2026-03-12 00:00:52,657 - core.chat.chat_streaming - ERROR - [ERR] [STREAMING FATAL] Unhandled error: Error code: 400 - {'type': 'error', 'error': {'type': 'invalid_request_error', 'message': 'messages: text content blocks must be non-empty'}, 'request_id': 'req_011CYxX3cFe7dQKDQGmVa51i'}
Traceback (most recent call last):
  File "/home/cisco/projects/sapphire/core/chat/chat_streaming.py", line 211, in chat_stream
    for event in self.current_stream:
  File "/home/cisco/projects/sapphire/core/chat/llm_providers/claude.py", line 365, in chat_completion_stream
    with stream_ctx as stream:
  File "/home/cisco/miniconda3/envs/sapphire/lib/python3.11/site-packages/anthropic/lib/streaming/_messages.py", line 167, in __enter__
    raw_stream = self.__api_request()
                 ^^^^^^^^^^^^^^^^^^^^
  File "/home/cisco/miniconda3/envs/sapphire/lib/python3.11/site-packages/anthropic/_base_client.py", line 1364, in post
    return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/cisco/miniconda3/envs/sapphire/lib/python3.11/site-packages/anthropic/_base_client.py", line 1137, in request
    raise self._make_status_error_from_response(err.response) from None
anthropic.BadRequestError: Error code: 400 - {'type': 'error', 'error': {'type': 'invalid_request_error', 'message': 'messages: text content blocks must be non-empty'}, 'request_id': 'req_011CYxX3cFe7dQKDQGmVa51i'}
2026-03-12 00:00:52,657 - core.chat.chat_streaming - INFO - [CLEANUP] [STREAMING FINALLY] Cleaning up, cancel_flag=False
2026-03-12 00:00:52,657 - core.routes.chat - ERROR - STREAMING ERROR: Error code: 400 - {'type': 'error', 'error': {'type': 'invalid_request_error', 'message': 'messages: text content blocks must be non-empty'}, 'request_id': 'req_011CYxX3cFe7dQKDQGmVa51i'}
Traceback (most recent call last):
  File "/home/cisco/projects/sapphire/core/routes/chat.py", line 222, in generate
    for event in system.llm_chat.chat_stream(data['text'], prefill=prefill, skip_user_message=skip_user_message, images=images, files=files):
  File "/home/cisco/projects/sapphire/core/chat/chat_streaming.py", line 211, in chat_stream
    for event in self.current_stream:
  File "/home/cisco/projects/sapphire/core/chat/llm_providers/claude.py", line 365, in chat_completion_stream
    with stream_ctx as stream:
  File "/home/cisco/miniconda3/envs/sapphire/lib/python3.11/site-packages/anthropic/lib/streaming/_messages.py", line 167, in __enter__
    raw_stream = self.__api_request()
                 ^^^^^^^^^^^^^^^^^^^^
  File "/home/cisco/miniconda3/envs/sapphire/lib/python3.11/site-packages/anthropic/_base_client.py", line 1364, in post
    return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/cisco/miniconda3/envs/sapphire/lib/python3.11/site-packages/anthropic/_base_client.py", line 1137, in request
    raise self._make_status_error_from_response(err.response) from None
anthropic.BadRequestError: Error code: 400 - {'type': 'error', 'error': {'type': 'invalid_request_error', 'message': 'messages: text content blocks must be non-empty'}, 'request_id': 'req_011CYxX3cFe7dQKDQGmVa51i'}
2026-03-12 00:00:52,760 - core.api_fastapi - INFO - REQ: GET /api/history
INFO:     127.0.0.1:54488 - "GET /api/history HTTP/1.1" 200 OK



Additional Context

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions