microsoft/autogen · error · UnsupportedKeywordError
Unsupported item type `{item_type_name}` in union array
Error message
Unsupported item type `{item_type_name}` in union array What it means
Error "Unsupported item type `{item_type_name}` in union array" thrown in microsoft/autogen.
Source
Thrown at python/packages/autogen-core/src/autogen_core/utils/_json_to_pydantic.py:199
types.append(self.get_ref(s["$ref"].split("/")[-1]))
elif "enum" in s:
types.append(Literal[tuple(s["enum"])] if len(s["enum"]) > 0 else Any)
else:
json_type = s.get("type")
if json_type not in TYPE_MAPPING:
raise UnsupportedKeywordError(f"Unsupported or missing type `{json_type}` in union")
# Handle array types with items specification
if json_type == "array" and "items" in s:
item_schema = s["items"]
if "$ref" in item_schema:
item_type = self.get_ref(item_schema["$ref"].split("/")[-1])
else:
item_type_name = item_schema.get("type")
if item_type_name is None:
item_type = str
elif item_type_name not in TYPE_MAPPING:
raise UnsupportedKeywordError(f"Unsupported item type `{item_type_name}` in union array")
else:
item_type = TYPE_MAPPING[item_type_name]
constraints = {}
if "minItems" in s:
constraints["min_length"] = s["minItems"]
if "maxItems" in s:
constraints["max_length"] = s["maxItems"]
array_type = conlist(item_type, **constraints) if constraints else List[item_type] # type: ignore[valid-type]
types.append(array_type)
else:
types.append(TYPE_MAPPING[json_type])
return types
def _extract_field_type(self, key: str, value: Dict[str, Any], model_name: str, root_schema: Dict[str, Any]) -> Any:
json_type = value.get("type")
if json_type not in TYPE_MAPPING:View on GitHub (pinned to 027ecf0a37)
Solutions
- Give the array a supported item type
Example fix
Set items to a supported type in the union array schema
When it happens
Trigger: Thrown at python/packages/autogen-core/src/autogen_core/utils/_json_to_pydantic.py:199 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of microsoft/autogen@027ecf0a37 (2026-08-15).
Data as JSON: /api/errors/7bffd49bd4c94c76.
Report an issue: GitHub.