Bug Description
sanitize_moonshot_tools() raises TypeError: unhashable type: 'list' when a tool parameter uses JSON Schema union types like "type": ["number", "string"].
Root Cause
In agent/moonshot_schema.py, the _fill_missing_type() function at line 138:
if "type" in node and node["type"] not in {None, ""}:
return node
When node["type"] is a list (valid JSON Schema for union types, e.g. ["number", "string"]), Python cannot hash the list to check membership in the set {None, ""}, raising TypeError: unhashable type: 'list'.
A similar issue exists at line 125:
if node_type in {"string", "integer", "number", "boolean"}:
Reproduction
Any tool with a parameter using union types triggers this. Example from the lcm_grep tool:
{
"time_from": {
"type": ["number", "string"],
"description": "Optional timestamp"
}
}
The model kimi-k2.6 (detected as moonshot via is_moonshot_model()) triggers sanitize_moonshot_tools() which hits this code path.
Error Log
TypeError: unhashable type: 'list'
File "agent/moonshot_schema.py", line 138, in _fill_missing_type
if "type" in node and node["type"] not in {None, ""}:
Suggested Fix
Line 138:
if "type" in node:
t = node["type"]
if isinstance(t, list):
return node # union type is a valid type declaration
if t not in {None, ""}:
return node
Line 125:
if isinstance(node_type, str) and node_type in {"string", "integer", "number", "boolean"}:
Environment
- Hermes Agent v0.14.0
- OpenAI SDK 2.24.0
- Provider: ollama-cloud (ollama.com/v1)
- Model: kimi-k2.6
Impact
This is a non-retryable error that completely blocks any conversation when:
- The model name matches
is_moonshot_model() (any kimi-* model)
- Any tool in the toolset uses JSON Schema union types for parameters
Affects: interactive sessions, cron jobs, curator reviews — any agent run using kimi models with the standard toolset.
Bug Description
sanitize_moonshot_tools()raisesTypeError: unhashable type: 'list'when a tool parameter uses JSON Schema union types like"type": ["number", "string"].Root Cause
In
agent/moonshot_schema.py, the_fill_missing_type()function at line 138:When
node["type"]is a list (valid JSON Schema for union types, e.g.["number", "string"]), Python cannot hash the list to check membership in the set{None, ""}, raisingTypeError: unhashable type: 'list'.A similar issue exists at line 125:
Reproduction
Any tool with a parameter using union types triggers this. Example from the
lcm_greptool:{ "time_from": { "type": ["number", "string"], "description": "Optional timestamp" } }The model
kimi-k2.6(detected as moonshot viais_moonshot_model()) triggerssanitize_moonshot_tools()which hits this code path.Error Log
Suggested Fix
Line 138:
Line 125:
Environment
Impact
This is a non-retryable error that completely blocks any conversation when:
is_moonshot_model()(any kimi-* model)Affects: interactive sessions, cron jobs, curator reviews — any agent run using kimi models with the standard toolset.