sgl-project/sglang · error · ValueError

composite_input event payload must be a map

Error message

composite_input event payload must be a map

What it means

A composite_input event payload must be a JSON object (dict). This check fires when the payload is a list, string, number, or null instead of a map containing input_types and the declared inputs.

Source

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

    ) -> 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:
            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(

View on GitHub (pinned to 0132848349)

Solutions

  1. Send composite_input as an object: {"input_types": [...], <type>: <payload>}
  2. Read the adapter's _ingest_composite_input for the exact shape
  3. Use simple 'prompt'/'camera_actions' events if you don't need composition

Example fix

// before
{kind: "composite_input", payload: ["prompt"]}
// after
{kind: "composite_input", payload: {input_types: ["prompt"], prompt: "hello"}}
Defensive patterns

Strategy: type-guard

Validate before calling

assert isinstance(payload, dict) and isinstance(payload.get('input_types'), list)

Type guard

def is_composite_payload(x: object) -> bool: return isinstance(x, dict) and isinstance(x.get('input_types'), list) and bool(x['input_types'])

Prevention

When it happens

Trigger: ws.send({kind: "composite_input", payload: ["prompt"]}) — passing an array where the adapter expects a map with an input_types key.

Common situations: Client modeling composite input as a plain array of items; misunderstanding the composite_input contract (input_types declares which keys are present).

Related errors


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