sgl-project/sglang · error · ValueError

Kimi K3 additional parameter schema accepts no values

Error message

Kimi K3 additional parameter schema accepts no values

What it means

While building the Kimi K3 structural-tag grammar, _dynamic_argument_format found that the given JSON schema (a value schema inside properties or additionalProperties) matches none of the supported JSON type variants, so no valid value format exists. This means the tool schema contains only unsupported constructs (e.g. only unsupported keywords or a type the converter cannot map).

Source

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

    root_schema: Dict[str, Any],
    loose_strings: bool = False,
) -> Format:
    variants = [
        SequenceFormat(
            elements=[
                RegexFormat(pattern=r'[^"& \t\r\n\f\v=<>]+'),
                ConstStringFormat(
                    value=(f'" type="{_JSON_TO_XTML_TYPE[json_type]}"<|sep|>')
                ),
                value_format,
            ]
        )
        for json_type, value_format in _argument_value_variants(
            schema, root_schema, loose_strings=loose_strings
        )
    ]
    if not variants:
        raise ValueError("Kimi K3 additional parameter schema accepts no values")
    content = variants[0] if len(variants) == 1 else OrFormat(elements=variants)
    return TagFormat(
        begin='<|open|>argument key="',
        content=content,
        end=ARGUMENT_CLOSE,
    )


def _strict_arguments_format(parameters: Dict[str, Any]) -> Format:
    properties = parameters.get("properties", {})
    if not isinstance(properties, dict):
        raise ValueError("Kimi K3 tool parameters 'properties' must be an object")
    required = parameters.get("required", [])
    if not isinstance(required, list) or not all(
        isinstance(item, str) for item in required
    ):
        raise ValueError("Kimi K3 tool parameters 'required' must be a string list")

View on GitHub (pinned to 0132848349)

Solutions

  1. Inspect the failing tool's parameter schema and simplify it to standard JSON Schema types (string/number/boolean/object/array/null or type arrays)
  2. Replace unsatisfiable constructs (pure not/allOf-only schemas) with explicit types
  3. If additionalProperties should allow anything, use additionalProperties: true or omit it

Example fix

// before
{"additionalProperties": {"not": {"type": "string"}}}
// after
{"additionalProperties": True}
Defensive patterns

Strategy: validation

Validate before calling

def schema_has_supported_type(s):
    if s is True or s is False:
        return s is True
    if not isinstance(s, dict):
        return False
    if "type" in s:
        t = s["type"]
        allowed = {"string","number","integer","boolean","object","array","null"}
        return (t in allowed) if isinstance(t, str) else bool(set(t) & allowed)
    return any(schema_has_supported_type(s.get(k, {})) for k in ("anyOf","oneOf","items","additionalProperties"))

Type guard

def is_supported_value_schema(s) -> bool:
    return schema_has_supported_type(s)

Try / catch

try:
    tag = build_tag(tools)
except ValueError as e:
    if "accepts no values" in str(e):
        simplify_tool_schemas(tools)  # then rebuild
    else:
        raise

Prevention

When it happens

Trigger: Passing a tool whose additionalProperties schema or property schema accepts no values under _argument_value_variants — e.g. a schema with no recognizable type and no supported combinators, or an unsatisfiable schema like {"not": {}}.

Common situations: Hand-written or LLM-generated tool JSON schemas with exotic/unsupported keywords; schemas generated by another framework that emit empty schema objects {} for additionalProperties in strict mode.

Related errors


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