diff --git a/studio/backend/routes/inference.py b/studio/backend/routes/inference.py index b5f0cd3ebf..50453f88bd 100644 --- a/studio/backend/routes/inference.py +++ b/studio/backend/routes/inference.py @@ -887,6 +887,9 @@ def _build_external_messages( result = [] for msg in messages: if isinstance(msg.content, str): + # Skip assistant messages with empty content (some providers reject them) + if msg.role == "assistant" and not msg.content.strip(): + continue result.append({"role": msg.role, "content": msg.content}) elif isinstance(msg.content, list): if supports_vision: