{"record":{"id":"125a701d25efb12c","repo":"docling-project/docling","slug":"invalid-metadata-response-from-self-model-metadat","errorCode":null,"errorMessage":"Invalid metadata response from {self.model_metadata_url}: {exc}","messagePattern":"Invalid metadata response from (.+?): (.+?)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"docling/models/inference_engines/common/kserve_v2_http.py","lineNumber":311,"sourceCode":"\n    def get_model_metadata(self) -> KserveV2ModelMetadataResponse:\n        \"\"\"Fetch model metadata from KServe v2 endpoint.\n\n        Returns:\n            Validated model metadata including inputs/outputs schema\n\n        Raises:\n            requests.exceptions.Timeout: If request exceeds timeout\n            requests.exceptions.ConnectionError: If cannot connect to server\n            requests.exceptions.HTTPError: If server returns error status\n            RuntimeError: If response format is invalid\n        \"\"\"\n        response = self._execute_http_request(self.model_metadata_url, method=\"GET\")\n\n        try:\n            return KserveV2ModelMetadataResponse.model_validate(response.json())\n        except Exception as exc:\n            raise RuntimeError(\n                f\"Invalid metadata response from {self.model_metadata_url}: {exc}\"\n            ) from exc\n\n    def infer(\n        self,\n        *,\n        inputs: Mapping[str, np.ndarray],\n        output_names: list[str],\n        request_parameters: Optional[Mapping[str, Any]] = None,\n    ) -> Dict[str, np.ndarray]:\n        \"\"\"Execute inference request against KServe v2 endpoint.\n\n        Args:\n            inputs: Mapping of input tensor names to numpy arrays\n            output_names: List of expected output tensor names\n            request_parameters: Optional KServe v2 request-level parameters\n\n        Returns:","sourceCodeStart":293,"sourceCodeEnd":329,"githubUrl":"https://github.com/docling-project/docling/blob/61d76f1ff3f8428065465889f7b4577da7df704c/docling/models/inference_engines/common/kserve_v2_http.py#L293-L329","documentation":"The GET to the model metadata URL returned a body that failed KserveV2ModelMetadataResponse.model_validate - either not JSON (HTML error page) or JSON missing required fields (name, inputs with name/datatype/shape). The chained exception is the json/pydantic error. The client uses metadata to plan inference, so it aborts.","triggerScenarios":"base_url wrong so the metadata route 404s into an HTML page served with 200; an auth wall returning a JSON login payload instead of metadata; a v2-incompatible server lacking /v2/models/<m>; versions/inputs shape differing from the pydantic contract (e.g. shape entries neither int nor str).","commonSituations":"Pointing the client at a v1-only Triton or a KServe v1 endpoint; trailing-slash or path-join mistakes in base_url; proxies answering before the model server; model name typo producing an error body.","solutions":["curl the metadata URL directly and read the body - fix whatever it actually returns (auth error, 404 HTML, wrong path)","Verify the URL shape: <base>/v2/models/<model_name> for KServe v2","Confirm the server really speaks KServe v2 protocol, not just gRPC/HTTP v1","Ensure auth headers/metadata reach the metadata request too"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"import requests\n\nresp = requests.get(f\"{base_url}/v2/models/{model_name}\", timeout=timeout)\nassert resp.status_code == 200, resp.status_code\nbody = resp.json()  # raises immediately if the body is HTML/error JSON\nassert \"inputs\" in body and \"name\" in body, body","typeGuard":null,"tryCatchPattern":"try:\n    metadata = client.get_model_metadata()\nexcept RuntimeError as e:\n    if \"Invalid metadata response\" in str(e):\n        raise  # inspect e.__cause__; fix URL/auth/server, do not ignore\n    raise","preventionTips":["curl the metadata URL manually when configuring a new endpoint","Ensure auth credentials are applied to metadata requests too","Confirm the server implements KServe v2 (not v1) before using this client"],"tags":["http","kserve","metadata","configuration","response-format"],"backgroundTag":null,"analyzedSha":"61d76f1ff3f8428065465889f7b4577da7df704c","analyzedAt":"2026-08-14T23:53:18.727Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}