BerriAI/litellm · error · ValueError
Azure Document Intelligence returned 202 but no…
Error message
Azure Document Intelligence returned 202 but no Operation-Location header found
What it means
Error "Azure Document Intelligence returned 202 but no Operation-Location header found" thrown in BerriAI/litellm.
Solutions
- Check the 202 response headers; the endpoint must return an Operation-Location header. Verify the endpoint and api_version.
When it happens
Trigger: Thrown at litellm/llms/azure_ai/ocr/document_intelligence/transformation.py:584 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18).
Data as JSON: /api/errors/90a0f1e7484773b8.
Report an issue: GitHub.
Appendix: source
Thrown at litellm/llms/azure_ai/ocr/document_intelligence/transformation.py:584
self._check_timeout(start_time=start_time, timeout_secs=timeout_secs)
# Poll the operation status
response = await client.get(url=operation_url, headers=headers)
# Check operation status
status = self._check_operation_status(response=response)
if status == "succeeded":
return response
elif status == "running":
# Wait before polling again
retry_after = self._get_retry_after(response=response)
await asyncio.sleep(retry_after)
def _get_polling_target(self, raw_response: httpx.Response) -> tuple[str, dict[str, str]]:
operation_url: Final = raw_response.headers.get("Operation-Location")
if not operation_url:
raise ValueError("Azure Document Intelligence returned 202 but no Operation-Location header found")
# Reject cross-origin polling URLs — the auth headers
# below would otherwise leak to whatever URL the upstream
# (or an attacker-controlled upstream) returns. VERIA-51.
try:
assert_same_origin(operation_url, str(raw_response.request.url))
except SSRFError as ssrf_err:
raise ValueError(f"Azure Document Intelligence: rejected polling URL ({ssrf_err})")
poll_headers = {"Ocp-Apim-Subscription-Key": raw_response.request.headers.get("Ocp-Apim-Subscription-Key", "")}
return operation_url, poll_headers
def _transform_completed_response(self, model: str, raw_response: httpx.Response) -> OCRResponse:
"""
Transform a completed Azure Document Intelligence analyze operation
into the Mistral OCR response shape, preserving Azure-native
`analyzeResult` fields (`content`, `tables`, `keyValuePairs`) as
top-level response fields.View on GitHub (pinned to 77b7c6c40c)