{"record":{"id":"816d948a5bde5e8d","repo":"PaddlePaddle/PaddleOCR","slug":"response-json-must-contain-object-field-data","errorCode":null,"errorMessage":"Response JSON must contain object field 'data'.","messagePattern":"Response JSON must contain object field 'data'\\.","errorType":"exception","errorClass":"ResponseFormatError","httpStatus":null,"severity":"error","filePath":"paddleocr/_api_client/_core.py","lineNumber":170,"sourceCode":"        raise AuthError(f\"Authentication failed: {msg}\")\n    if status_code == 400:\n        raise InvalidRequestError(f\"Bad request: {msg}\")\n    if status_code == 429:\n        raise RateLimitError(f\"Rate limit exceeded: {msg}\")\n    if status_code in (503, 504):\n        raise ServiceUnavailableError(status_code, f\"Service unavailable: {msg}\")\n    raise APIError(status_code, msg)\n\n\ndef unwrap_api_response(payload: dict, status_code: int) -> dict:\n    if not isinstance(payload, dict):\n        raise ResponseFormatError(\"Response body must be a JSON object.\")\n    code = payload.get(\"code\", 0)\n    if code not in (0, None):\n        raise APIError(status_code, extract_api_message_from_payload(payload) or \"\")\n    data = payload.get(\"data\")\n    if not isinstance(data, dict):\n        raise ResponseFormatError(\"Response JSON must contain object field 'data'.\")\n    return data\n\n\ndef extract_job_id(data: dict) -> str:\n    job_id = data.get(\"jobId\")\n    if not isinstance(job_id, str) or not job_id:\n        raise ResponseFormatError(\n            \"Response data must contain non-empty string 'jobId'.\"\n        )\n    return job_id\n\n\ndef validate_result_json_url(data: dict) -> str:\n    result_url = data.get(\"resultUrl\")\n    if not isinstance(result_url, dict):\n        raise ResponseFormatError(\"Done job response must contain object 'resultUrl'.\")\n    json_url = result_url.get(\"jsonUrl\")\n    if not isinstance(json_url, str) or not json_url:","sourceCodeStart":152,"sourceCodeEnd":188,"githubUrl":"https://github.com/PaddlePaddle/PaddleOCR/blob/2661c7c0ef5c613e8f93c6e93b2e052399f0f854/paddleocr/_api_client/_core.py#L152-L188","documentation":"Error \"Response JSON must contain object field 'data'.\" thrown in PaddlePaddle/PaddleOCR.","triggerScenarios":"Raised by unwrap_api_response() when the HTTP response was valid JSON but the 'data' field is missing or is not an object (dict).","commonSituations":"The official API returned a JSON object whose 'data' field is missing or not an object. This happens with unexpected server responses or proxy-modified payloads. Log the raw response and verify the API endpoint and request parameters.","solutions":["Verify the PaddleOCR API server returned a payload whose top-level 'data' field is a JSON object.","Check that you are calling the correct API endpoint and API version; an unexpected response shape usually indicates an endpoint or proxy mismatch.","Capture the raw response body (enable debug logging) and confirm it is not an HTML error page from a proxy or gateway."],"exampleFix":"data = resp.json()\nif not isinstance(data.get(\"data\"), dict):\n    # inspect data to see what the server actually returned\n    print(data)","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"2661c7c0ef5c613e8f93c6e93b2e052399f0f854","analyzedAt":"2026-08-14T20:17:30.180Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}