sgl-project/sglang · error · ValueError

Kimi K3 required parameter {key!r} accepts no values

Error message

Kimi K3 required parameter {key!r} accepts no values

What it means

A property listed in required has a schema, but _known_argument_format cannot derive any value format for it (e.g. an empty schema {} or an unsupported construct). Since optional properties can simply be skipped, only required ones that accept no values are fatal for the grammar.

Source

Thrown at python/sglang/srt/function_call/kimik3_structural_tag.py:403

        isinstance(item, str) for item in required
    ):
        raise ValueError("Kimi K3 tool parameters 'required' must be a string list")

    required_set = set(required)
    missing = required_set.difference(properties)
    if missing:
        raise ValueError(
            f"Kimi K3 required parameters are missing schemas: {sorted(missing)!r}"
        )

    elements: List[Format] = []
    for key, schema in properties.items():
        if not isinstance(key, str) or not isinstance(schema, (bool, dict)):
            raise ValueError("Kimi K3 tool property schemas must be JSON schemas")
        argument = _known_argument_format(key, schema, parameters)
        if argument is None:
            if key in required_set:
                raise ValueError(
                    f"Kimi K3 required parameter {key!r} accepts no values"
                )
            continue
        elements.append(
            argument if key in required_set else OptionalFormat(content=argument)
        )

    additional = parameters.get("additionalProperties", True)
    if additional is True:
        elements.append(StarFormat(content=_dynamic_argument_format(True, parameters)))
    elif isinstance(additional, dict):
        elements.append(
            StarFormat(content=_dynamic_argument_format(additional, parameters))
        )
    elif additional is not False:
        raise ValueError(
            "Kimi K3 tool parameters 'additionalProperties' must be a schema"
        )

View on GitHub (pinned to 0132848349)

Solutions

  1. Give the required property a concrete supported type schema, e.g. {"type": "string"}
  2. If the property is genuinely free-form, decide whether it must be required; either type it or move it out of required
  3. Test each required property schema in isolation against the supported type set

Example fix

// before
"properties": {"x": {}}, "required": ["x"]
// after
"properties": {"x": {"type": "string"}}, "required": ["x"]
Defensive patterns

Strategy: validation

Validate before calling

for k in params.get("required", []):
    assert _argument_value_variants(params["properties"][k], params), f"{k} accepts no values"

Type guard

def required_params_typeable(params: dict) -> bool:
    return all(
        isinstance(params["properties"].get(k), (bool, dict)) and params["properties"].get(k) not in ({}, False)
        for k in params.get("required", [])
    )

Try / catch

try:
    build_tag(tools)
except ValueError as e:
    if "accepts no values" in str(e):
        add_concrete_types(tools)
    else:
        raise

Prevention

When it happens

Trigger: "required": ["x"] with "x": {} or a schema that yields zero variants in _argument_value_variants (same root cause as the additionalProperties variant of this error, but on a mandatory property).

Common situations: Placeholder/empty schemas for mandatory fields; schemas relying only on unsupported JSON Schema keywords; strict-mode schemas that omit type.

Related errors


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