{"record":{"id":"da78fcce53521073","repo":"BerriAI/litellm","slug":"got-an-unexpected-none-response-from-the-ocr-api","errorCode":null,"errorMessage":"Got an unexpected None response from the OCR API: {response}","messagePattern":"Got an unexpected None response from the OCR API: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/ocr/main.py","lineNumber":431,"sourceCode":"            model=prepared.model,\n            document=prepared.document,\n            optional_params=prepared.optional_params,\n            timeout=prepared.effective_timeout,\n            logging_obj=prepared.litellm_logging_obj,\n            api_key=prepared.api_key,\n            api_base=prepared.api_base,\n            custom_llm_provider=prepared.custom_llm_provider,\n            aocr=True,\n            headers=prepared.extra_headers,\n            provider_config=prepared.provider_config,\n            litellm_params=prepared.litellm_params,\n        )\n\n        if asyncio.iscoroutine(response):\n            response = await response\n\n        if response is None:\n            raise ValueError(f\"Got an unexpected None response from the OCR API: {response}\")\n\n        return response\n    except Exception as e:\n        raise litellm.exception_type(\n            model=model,\n            custom_llm_provider=custom_llm_provider,\n            original_exception=e,\n            completion_kwargs=completion_kwargs,\n            extra_kwargs=kwargs,\n        )\n\n\n#################################################\n# Public utilities — used by the SDK and the proxy\n#################################################\n\n_MIME_PATTERN: Final = re.compile(r\"^[\\w.+-]+/[\\w.+-]+$\")\n","sourceCodeStart":413,"sourceCodeEnd":449,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/ocr/main.py#L413-L449","documentation":"Guard after the awaited provider OCR call: the coroutine resolved to None instead of a response object, meaning the provider handler returned nothing usable. The raw None is echoed since it carries no further detail.","triggerScenarios":"Thrown at litellm/ocr/main.py:431 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check that the OCR API endpoint and credentials are valid; a None response means the request returned nothing.","Verify the model/provider supports OCR and the file was uploaded correctly."],"exampleFix":"Confirm the OCR model name and API key, then retry; log response.status_code to see why the API returned None.","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}