mlflow/mlflow · error · MlflowException
Unknown content type: {content_type['type']}. Please make su
Error message
Unknown content type: {content_type['type']}. Please make sure the message is a valid Anthropic message object. If it is a valid type, contact to the MLflow maintainer via https://github.com/mlflow/mlflow/issues/new/choose for requesting support for a new message type. What it means
Within a list content, each block's 'type' must be one MLflow knows: text, image, tool_use, tool_result, or thinking (Claude 3.7 extended thinking, mapped to text). An unrecognized block type cannot be converted to a ContentPart, so MLflow raises this error and asks you to file an issue if the type is genuinely valid Anthropic content.
Source
Thrown at mlflow/anthropic/chat.py:110
content_type = content.get("type")
if content_type == "text":
return TextContentPart(text=content["text"], type="text")
elif content_type == "image":
source = content["source"]
return ImageContentPart(
image_url=ImageUrl(
url=f"data:{source['media_type']};{source['type']},{source['data']}"
),
type="image_url",
)
# Claude 3.7 added new "thinking" content block, which is essentially a text block as of now.
# TODO: We should consider adding a new ContentPart type if more providers support this.
# https://docs.anthropic.com/en/docs/build-with-claude/extended-thinking
elif content_type == "thinking":
return TextContentPart(text=content["thinking"], type="text")
else:
raise MlflowException.invalid_parameter_value(
f"Unknown content type: {content_type['type']}. Please make sure the message "
"is a valid Anthropic message object. If it is a valid type, contact to the "
"MLflow maintainer via https://github.com/mlflow/mlflow/issues/new/choose for "
"requesting support for a new message type."
)
def convert_tool_to_mlflow_chat_tool(tool: dict[str, Any]) -> ChatTool:
"""
Convert Anthropic tool definition into MLflow's standard format (OpenAI compatible).
Ref: https://docs.anthropic.com/en/docs/build-with-claude/tool-use
Args:
tool: A dictionary represents a single tool definition in the input request.
Returns:
ChatTool: MLflow's standard tool definition object.View on GitHub (pinned to 6a27f2decc)
Solutions
- Upgrade MLflow to the latest version, which may support the new block type
- Strip or pre-convert unsupported blocks to {'type': 'text', 'text': ...} before logging
- If the type is valid Anthropic content, file an issue at https://github.com/mlflow/mlflow/issues/new/choose
- Verify each block dict has a correctly spelled 'type' key
Example fix
// before
blocks = [{"type": "document", "source": {...}}]
// after
blocks = [{"type": "text", "text": extract_text_from_document()}] # or upgrade mlflow Defensive patterns
Strategy: try-catch
Validate before calling
KNOWN = {"text", "image", "tool_use", "tool_result", "thinking"}
unsupported = [b["type"] for m in messages if isinstance(m.get("content"), list)
for b in m["content"] if isinstance(b, dict) and b.get("type") not in KNOWN]
assert not unsupported, f"Unsupported block types: {unsupported}" Type guard
def is_supported_block(b: dict) -> bool:
return isinstance(b, dict) and b.get("type") in {"text", "image", "tool_use", "tool_result", "thinking"} Try / catch
try:
trace = model_to_chat(response)
except MlflowException as e:
if "Unknown content type" in str(e):
response.content = [b for b in response.content if getattr(b, "type", None) in {"text", "tool_use", "thinking"}]
trace = model_to_chat(response)
else:
raise Prevention
- Keep MLflow updated when adopting new Anthropic features (documents, web search)
- Filter or flatten unsupported blocks before logging traces
- Check mlflow release notes for new Anthropic content-type support
When it happens
Trigger: A content block with 'type' like 'document', 'server_tool_use', 'web_search_tool_result', 'redacted_thinking', or any new Anthropic block type not yet handled by your MLflow version; passing through _parse_content with a dict lacking/misspelling 'type' (content_type becomes None).
Common situations: Using new Anthropic API features (documents/PDFs, web search, code execution blocks) with an older MLflow; a typo in the 'type' field; 'type' key missing entirely so None is reported.
Related errors
- Message must be either a dict or a Message object, but got:
- Invalid content type. Must be either a string or a list, but
- 'use_dspy_model_save' option is only supported for DSPy vers
- Streaming API is only supported in dspy 2.6.24 or later. Ple
- Cannot set both 'temperature' and 'top_p' parameters.
AI-assisted analysis of mlflow/mlflow@6a27f2decc (2026-08-29).
Data as JSON: /api/errors/d36efb0dd55a759c.
Report an issue: GitHub.