mlflow/mlflow · error · MlflowException

Empty content in final response from Databricks judge

Error message

Empty content in final response from Databricks judge

What it means

When parsing the Databricks judge model's final agent response, parse_structured_output requires non-empty content to parse into the output schema. An empty/None final message indicates the judge model produced no content, so MLflow throws instead of returning an empty structured result.

Source

Thrown at mlflow/genai/judges/utils/invocation_utils.py:148

    # Add schema instructions to the system message
    schema_instruction = (
        f"\n\nYou must return your response as JSON matching this schema:\n"
        f"{json.dumps(output_schema.model_json_schema(), indent=2)}"
    )
    if judge_messages and judge_messages[0].role == "system":
        judge_messages[0] = ChatMessage(
            role="system",
            content=judge_messages[0].content + schema_instruction,
        )
    else:
        judge_messages.insert(
            0,
            ChatMessage(role="system", content=schema_instruction),
        )

    def parse_structured_output(content: str | None) -> pydantic.BaseModel:
        if not content:
            raise MlflowException("Empty content in final response from Databricks judge")
        try:
            cleaned = _strip_markdown_code_blocks(content)
            response_dict = json.loads(cleaned, strict=False)
            return output_schema(**response_dict)
        except json.JSONDecodeError as e:
            raise MlflowException(
                f"Failed to parse JSON response from Databricks judge: {e}\n\nResponse: {content}"
            ) from e
        except pydantic.ValidationError as e:
            raise MlflowException(
                f"Response does not match expected schema: {e}\n\nResponse: {content}"
            ) from e

    return _run_databricks_agentic_loop(judge_messages, trace, parse_structured_output)


def get_chat_completions_with_structured_output(
    model_uri: str,

View on GitHub (pinned to 6a27f2decc)

Solutions

  1. Use a more capable judge model (e.g. a frontier model on the Databricks endpoint)
  2. Re-run the judge; transient empty completions often succeed on retry
  3. Check endpoint health/logs for truncation or content filtering
  4. Ensure the prompt/schema instruction requests a final JSON answer rather than stopping after tool calls
Defensive patterns

Strategy: retry

Type guard

def has_content(resp): return bool(getattr(resp, "content", None))

Try / catch

try:
    result = judge.invoke(inputs)
except MlflowException as e:
    if "Empty content" in str(e):
        result = judge.invoke(inputs)  # retry once, then escalate model
    else:
        raise

Prevention

When it happens

Trigger: Running a Databricks judge via the agentic loop where the model's final response has empty or None content — e.g. the model returned only tool calls and ended, hit a content filter, or the serving endpoint returned an empty completion.

Common situations: Weak/small judge models that terminate without emitting text, truncated responses from overloaded Databricks endpoints, misconfigured agent loop that never reaches a text answer.

Related errors


AI-assisted analysis of mlflow/mlflow@6a27f2decc (2026-08-29). Data as JSON: /api/errors/809e107e1057ca88. Report an issue: GitHub.