sgl-project/sglang · error · ValueError
prompt event payload must be a non-empty string
Error message
prompt event payload must be a non-empty string
What it means
_validate_prompt_payload requires the prompt payload (from a prompt event or a composite_input 'prompt' item) to be a non-empty string; None, non-strings, or empty strings are rejected.
Source
Thrown at python/sglang/multimodal_gen/runtime/entrypoints/openai/realtime/adapters/lingbot_world_realtime_adapter.py:184
return state.receive_camera_control_event_payload(
payload,
event_id=event_id,
)
def _ingest_prompt(
self,
state: LingBotWorldRealtimeState,
payload: Any,
event_id: int | None,
) -> str:
prompt = self._validate_prompt_payload(payload)
state.receive_prompt(prompt, event_id=event_id)
return f"kind=prompt, prompt_len={len(prompt)}"
@staticmethod
def _validate_prompt_payload(payload: Any) -> str:
if not isinstance(payload, str) or not payload:
raise ValueError("prompt event payload must be a non-empty string")
return payload
def _ingest_composite_input(
self,
state: LingBotWorldRealtimeState,
payload: Any,
event_id: int | None,
) -> str:
if not isinstance(payload, dict):
raise ValueError("composite_input event payload must be a map")
input_types = payload.get("input_types")
if not isinstance(input_types, list) or not input_types:
raise ValueError(
"composite_input event payload requires non-empty input_types"
)
parsed_inputs = []
for input_type in input_types:View on GitHub (pinned to 0132848349)
Solutions
- Always include a non-empty prompt string when the event/item declares prompt
- Default to a placeholder prompt (e.g. 'continue') if your flow allows empty intent
- Skip sending the prompt event entirely when there is no prompt
Example fix
// before
{kind: "prompt", payload: ""}
// after
{kind: "prompt", payload: "continue"} Defensive patterns
Strategy: validation
Validate before calling
if not isinstance(prompt, str) or not prompt: prompt = 'continue'
Type guard
def is_nonempty_str(x: object) -> bool: return isinstance(x, str) and bool(x)
Try / catch
except ValueError as e: if 'non-empty string' in str(e): default the prompt and resend
Prevention
- Default empty prompts client-side
- Omit the prompt event when there's nothing to say
When it happens
Trigger: Sending a prompt event with payload "" or null, or a composite_input item declaring input_types: ["prompt"] without a non-empty prompt value.
Common situations: Client sends empty prompt to 'kick off' a session; optional prompt field serialized as None by a Python client; whitespace-only is fine but truly empty strings are not.
Related errors
- prompt event payload must be a string
- camera_actions event payload must be list[list[str]]
- composite_input event payload must be a map
- composite_input event payload requires non-empty input_types
- composite_input input_types must contain non-empty strings
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/04f43845f3c20fe1.
Report an issue: GitHub.