sgl-project/sglang · error · ValueError

composite_input event payload requires {input_type}

Error message

composite_input event payload requires {input_type}

What it means

For every type listed in input_types, the payload map must contain a same-named key with that input's data. Missing any declared key raises this with the type name.

Source

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

        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:
            input_logs.append(
                self._ingest_parsed_composite_input_item(
                    state,
                    input_type,

View on GitHub (pinned to 0132848349)

Solutions

  1. Keep input_types and the payload keys exactly in sync — declare only what you send
  2. Use exact snake_case key names for each declared type
  3. Build the payload and input_types together: input_types = list(payload_keys minus 'input_types')

Example fix

// before
{input_types: ["prompt", "camera_actions"], prompt: "hi"}
// after
{input_types: ["prompt"], prompt: "hi"}
Defensive patterns

Strategy: validation

Validate before calling

for t in payload['input_types']:
    assert t in payload, f'missing key {t}'
assert set(payload['input_types']) <= (set(payload) - {'input_types'})

Try / catch

except ValueError as e: if 'requires' in str(e): add the missing key and resend

Prevention

When it happens

Trigger: {input_types: ["prompt", "camera_actions"], prompt: "hi"} — camera_actions declared but not present in the payload map.

Common situations: Client conditionally omitting optional inputs but still listing them in input_types; key naming mismatch (e.g. 'cameraActions' vs 'camera_actions').

Understand the failure class

Background: Missing required parameter errors: what 'X is required' and 'the required X param is missing' mean, and how to fix them — this error's family across 27 libraries.

Related errors


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