sgl-project/sglang · error · ValueError

composite_input input_types must contain non-empty strings

Error message

composite_input input_types must contain non-empty strings

What it means

Each element of composite_input's input_types must be a non-empty string naming a supported input modality. Non-string, empty, or None elements are rejected.

Source

Thrown at python/sglang/multimodal_gen/runtime/entrypoints/openai/realtime/adapters/lingbot_world_realtime_adapter.py:204

    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:
            if not isinstance(input_type, str) or not input_type:
                raise ValueError(
                    "composite_input input_types must contain non-empty strings"
                )
            if input_type not in payload:
                raise ValueError(f"composite_input event payload requires {input_type}")
            parsed_inputs.append(
                (
                    input_type,
                    self._parse_composite_input_item(
                        state,
                        input_type,
                        payload[input_type],
                        event_id,
                    ),
                )
            )

        input_logs = []
        for input_type, parsed_payload in parsed_inputs:

View on GitHub (pinned to 0132848349)

Solutions

  1. Filter falsy entries out of input_types before sending: [t for t in types if isinstance(t, str) and t]
  2. Only use known type names ('prompt', camera types)
  3. Assert the list is non-empty after filtering

Example fix

// before
input_types = [maybe_prompt]  # maybe_prompt may be None
// after
input_types = [t for t in [maybe_prompt] if isinstance(t, str) and t]
Defensive patterns

Strategy: type-guard

Validate before calling

payload['input_types'] = [t for t in payload['input_types'] if isinstance(t, str) and t]

Type guard

def valid_input_types(ts: object) -> bool: return isinstance(ts, list) and all(isinstance(t, str) and t for t in ts) and bool(ts)

Prevention

When it happens

Trigger: input_types: [null], input_types: [""], or input_types: [1] in a composite_input payload.

Common situations: Programmatically building input_types from optional values that end up None/empty; trimming whitespace into empty strings.

Related errors


AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28). Data as JSON: /api/errors/b0fb9447ed7c07eb. Report an issue: GitHub.