BerriAI/litellm · error · ValueError

Unknown operation status: {status}

Error message

Unknown operation status: {status}

What it means

Raised when the polled Azure DI operation response contains a `status` value outside the known set {succeeded, failed, running, notStarted}. This generally means Azure changed/added a status (e.g. a new 'canceled'/'skipped' value) or the response shape changed, and LiteLLM's parser cannot classify it. It is a defensive parse failure, not a user-input error.

Source

Thrown at litellm/llms/azure_ai/ocr/document_intelligence/transformation.py:489

        Raises:
            ValueError: If operation failed or status is unknown
        """
        try:
            result: Final = response.json()
            status: Final = result.get("status")

            verbose_logger.debug("Azure DI operation status: %s", status)

            if status == "succeeded":
                return "succeeded"
            elif status == "failed":
                error_msg: Final = result.get("error", {}).get("message", "Unknown error")
                raise ValueError(f"Azure Document Intelligence analysis failed: {error_msg}")
            elif status in ["running", "notStarted"]:
                return "running"
            else:
                raise ValueError(f"Unknown operation status: {status}")

        except Exception as e:
            if "succeeded" in str(e) or "failed" in str(e):
                raise
            # If we can't parse JSON, something went wrong
            raise ValueError(f"Failed to parse Azure DI operation response: {e}")

    def _poll_operation_sync(
        self,
        operation_url: str,
        headers: dict[str, str],
        timeout_secs: int,
    ) -> httpx.Response:
        """
        Poll Azure Document Intelligence operation until completion (sync).

        Azure DI POST returns 202 with Operation-Location header.
        We need to poll that URL until status is "succeeded" or "failed".

View on GitHub (pinned to 6c2dcb801b)

Solutions

  1. Upgrade LiteLLM to the latest version — new statuses are usually mapped once reported.
  2. If reproducible, capture the raw status value from the error message and report it in a LiteLLM issue.
  3. Retry the operation; transient odd statuses (rare) may not recur on resubmission.
Defensive patterns

Strategy: retry

Try / catch

try:
    resp = litellm.aocr_document(model=m, document=doc)
except ValueError as e:
    if "Unknown operation status" in str(e):
        log.error("unrecognized DI status — possible API drift: %s", e)
        # retry once; report status value upstream
    raise

Prevention

When it happens

Trigger: Azure introducing a new operation status in its DI API; a proxy or mock server returning a modified status field; the response body containing something like 'canceled' or 'cancelled' that the branch chain doesn't handle.

Common situations: Azure API version drift after LiteLLM's parser was written; testing against recorded/mocked responses with divergent status values; regional variants of the service.

Related errors


AI-assisted analysis of BerriAI/litellm@6c2dcb801b (2026-08-15). Data as JSON: /api/errors/0c2f57880395bfdf. Report an issue: GitHub.