mlflow/mlflow · error

Invalid status: {self.status} for {self.__class__.__name__}.

Error message

Invalid status: {self.status} for {self.__class__.__name__}. Must be 'in_progress', 'completed', or 'incomplete'.

What it means

The Status pydantic model in mlflow/types/responses_helpers.py validates Responses-API status values via a model validator. Any status other than None, 'in_progress', 'completed', or 'incomplete' is rejected, with the class name included in the message.

Source

Thrown at mlflow/types/responses_helpers.py:27

https://github.com/openai/openai-python/blob/ed53107e10e6c86754866b48f8bd862659134ca8/src/openai/types/responses/response.py#L31
https://github.com/openai/openai-python/blob/ed53107e10e6c86754866b48f8bd862659134ca8/src/openai/types/responses/response_stream_event.py#L42
"""


#########################
# Response helper classes
#########################
class Status(BaseModel):
    status: str | None = None

    @model_validator(mode="after")
    def check_status(self) -> "Status":
        if self.status is not None and self.status not in {
            "in_progress",
            "completed",
            "incomplete",
        }:
            raise ValueError(
                f"Invalid status: {self.status} for {self.__class__.__name__}. "
                "Must be 'in_progress', 'completed', or 'incomplete'."
            )
        return self


class ResponseError(BaseModel):
    code: str | None = None
    message: str


class AnnotationFileCitation(BaseModel):
    file_id: str
    index: int
    type: str = "file_citation"


class AnnotationURLCitation(BaseModel):

View on GitHub (pinned to 6a27f2decc)

Solutions

  1. Change status to one of 'in_progress', 'completed', 'incomplete'.
  2. Set status to None if unknown.
  3. Fix the producer of the payload to emit a valid status.
  4. Upgrade MLflow if a newer upstream status value is legitimately supported.

Example fix

// before
ResponseOutputMessage(id='m1', role='assistant', content=[...], status='done')
// after
ResponseOutputMessage(id='m1', role='assistant', content=[...], status='completed')
Defensive patterns

Strategy: validation

Validate before calling

VALID_STATUSES = {"in_progress", "completed", "incomplete"}
assert payload.get("status") in VALID_STATUSES or payload.get("status") is None

Type guard

def is_valid_status(s) -> bool:
    return s is None or s in {"in_progress", "completed", "incomplete"}

Try / catch

try:
    item = ResponseOutputMessage(**payload)
except ValueError as e:
    if 'Invalid status' in str(e):
        payload['status'] = None
        item = ResponseOutputMessage(**payload)
    else:
        raise

Prevention

When it happens

Trigger: Deserializing a ResponseOutputMessage / ResponseFunctionToolCall from JSON whose `status` is e.g. 'failed', 'done', or a truncated/typo'd value.

Common situations: Feeding output from a different (non-OpenAI) Responses implementation into MLflow's parsers; hand-editing captured trace payloads; SDK version drift producing new enum values the validator doesn't accept.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


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