{"record":{"id":"58a994c0682cc9bf","repo":"sgl-project/sglang","slug":"kimi-k3-tool-parameters-additionalproperties-mus","errorCode":null,"errorMessage":"Kimi K3 tool parameters 'additionalProperties' must be a schema","messagePattern":"Kimi K3 tool parameters 'additionalProperties' must be a schema","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/function_call/kimik3_structural_tag.py","lineNumber":419,"sourceCode":"        if argument is None:\n            if key in required_set:\n                raise ValueError(\n                    f\"Kimi K3 required parameter {key!r} accepts no values\"\n                )\n            continue\n        elements.append(\n            argument if key in required_set else OptionalFormat(content=argument)\n        )\n\n    additional = parameters.get(\"additionalProperties\", True)\n    if additional is True:\n        elements.append(StarFormat(content=_dynamic_argument_format(True, parameters)))\n    elif isinstance(additional, dict):\n        elements.append(\n            StarFormat(content=_dynamic_argument_format(additional, parameters))\n        )\n    elif additional is not False:\n        raise ValueError(\n            \"Kimi K3 tool parameters 'additionalProperties' must be a schema\"\n        )\n    if not elements:\n        return ConstStringFormat(value=\"\")\n    return SequenceFormat(elements=elements)\n\n\ndef _tool_arguments_format(tool: Tool) -> Format:\n    parameters = tool.function.parameters\n    if not tool.function.strict:\n        root_schema = parameters if isinstance(parameters, dict) else {}\n        return StarFormat(\n            content=_dynamic_argument_format(True, root_schema, loose_strings=True)\n        )\n    if parameters is None:\n        # Server-side strict levels mark tools without parameters strict too;\n        # they take no arguments rather than failing the whole constraint.\n        return ConstStringFormat(value=\"\")","sourceCodeStart":401,"sourceCodeEnd":437,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/function_call/kimik3_structural_tag.py#L401-L437","documentation":"tool.parameters.additionalProperties must be a JSON schema value: True (any value), a dict (schema for extra keys), or False (no extras). Any other value (string, list, number, null) is neither a valid schema nor the explicit 'closed' marker, so the strict builder rejects it.","triggerScenarios":"\"additionalProperties\": \"false\" (string) or \"additionalProperties\": [\"extra\"] in a tool schema sent with a Kimi K3 tool-call request.","commonSituations":"Schemas serialized from YAML/config where booleans become strings; hand-written configs confusing additionalProperties with a list of allowed extra keys; LLM-generated schemas.","solutions":["Use boolean True/False or an object schema for additionalProperties","Fix upstream serialization so booleans stay booleans (yaml quotes, env vars)","Validate the schema with a JSON Schema meta-schema check before submission"],"exampleFix":"// before\n\"additionalProperties\": \"false\"\n// after\n\"additionalProperties\": False","handlingStrategy":"validation","validationCode":"add = params.get(\"additionalProperties\", None)\nassert add is None or isinstance(add, (bool, dict)), \"additionalProperties must be bool or schema\"","typeGuard":"def valid_additional_properties(params: dict) -> bool:\n    a = params.get(\"additionalProperties\", None)\n    return a is None or isinstance(a, (bool, dict))","tryCatchPattern":"try:\n    build_tag(tools)\nexcept ValueError as e:\n    if \"additionalProperties\" in str(e):\n        coerce_bool_schema_fields(tools)\n    else:\n        raise","preventionTips":["Use real booleans, not 'true'/'false' strings","Check YAML/env serialization of schema booleans"],"tags":["kimi-k3","json-schema","additional-properties","validation"],"backgroundTag":"json-schema-validation-failed","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}