{"record":{"id":"ee7879664d958486","repo":"docling-project/docling","slug":"connections-to-remote-services-are-only-allowed-wh-ee7879","errorCode":null,"errorMessage":"Connections to remote services are only allowed when set explicitly. pipeline_options.enable_remote_services=True.","messagePattern":"Connections to remote services are only allowed when set explicitly\\. pipeline_options\\.enable_remote_services=True\\.","errorType":"exception","errorClass":"OperationNotAllowed","httpStatus":null,"severity":"error","filePath":"docling/models/inference_engines/object_detection/api_kserve_v2_engine.py","lineNumber":60,"sourceCode":"        accelerator_options: AcceleratorOptions,\n        artifacts_path: Optional[Union[Path, str]] = None,\n    ):\n        super().__init__(\n            options=options,\n            model_config=model_config,\n            accelerator_options=accelerator_options,\n            artifacts_path=artifacts_path,\n        )\n        self.options: ApiKserveV2ObjectDetectionEngineOptions = options\n        self._kserve_client: Optional[KserveV2Client] = None\n        self._input_images_name: Optional[str] = None\n        self._input_orig_target_sizes_name: Optional[str] = None\n        self._output_labels_name: Optional[str] = None\n        self._output_boxes_name: Optional[str] = None\n        self._output_scores_name: Optional[str] = None\n\n        if not enable_remote_services:\n            raise OperationNotAllowed(\n                \"Connections to remote services are only allowed when set explicitly. \"\n                \"pipeline_options.enable_remote_services=True.\"\n            )\n\n    def _resolve_model_name(self) -> str:\n        if self.options.model_name:\n            return self.options.model_name\n\n        return self._repo_id.replace(\"/\", \"--\")\n\n    def _resolve_model_version(self) -> Optional[str]:\n        return self.options.model_version\n\n    def _resolve_tensor_names(self) -> tuple[str, str, str, str, str]:\n        if self._kserve_client is None:\n            raise RuntimeError(\"KServe v2 client is not initialized.\")\n\n        metadata = self._kserve_client.get_model_metadata()","sourceCodeStart":42,"sourceCodeEnd":78,"githubUrl":"https://github.com/docling-project/docling/blob/61d76f1ff3f8428065465889f7b4577da7df704c/docling/models/inference_engines/object_detection/api_kserve_v2_engine.py#L42-L78","documentation":"The ApiKserveV2ObjectDetectionEngine constructor raises OperationNotAllowed when the enable_remote_services flag is False. Docling blocks any engine that connects to a remote KServe v2 inference server unless the user explicitly opts in, as a safety measure against unintended network calls. The flag comes from pipeline_options.enable_remote_services on the standard PipelineOptions object.","triggerScenarios":"Creating a StandardPipelineOptions (or ObjectDetectionPipeline options) with features.layout.object_detection.engine_options.engine_type = ObjectDetectionEngineType.API_KSERVE_V2 while pipeline_options.enable_remote_services is left at its default False, then running the pipeline / instantiating the engine.","commonSituations":"Copying an example that uses a KServe-hosted RT-DETR model without also copying the enable_remote_services=True line; assuming remote engines work out of the box like local ONNX ones; CI configs generated from templates that omit the flag.","solutions":["Set pipeline_options.enable_remote_services = True in your PipelineOptions before constructing the pipeline.","Verify you actually intend to call the remote KServe endpoint (URL, credentials, network reachability) since enabling the flag authorizes outbound connections.","If you did not want a remote call, switch engine_type back to ONNXRUNTIME or TRANSFORMERS so everything runs locally."],"exampleFix":"// before\npipeline_options = StandardPipelineOptions()\npipeline_options.features.layout.object_detection = True\npipeline_options.features.layout.object_detection_engine_options = ApiKserveV2ObjectDetectionEngineOptions(url=\"https://kserve.example.com\")\n\n// after\npipeline_options = StandardPipelineOptions()\npipeline_options.enable_remote_services = True\npipeline_options.features.layout.object_detection = True\npipeline_options.features.layout.object_detection_engine_options = ApiKserveV2ObjectDetectionEngineOptions(url=\"https://kserve.example.com\")","handlingStrategy":"validation","validationCode":"from docling.datamodel.pipeline_options import PdfPipelineOptions\n\nif opts.engine_type == ObjectDetectionEngineType.API_KSERVE_V2 and not pipeline_options.enable_remote_services:\n    raise SystemExit(\"Set pipeline_options.enable_remote_services=True before using the KServe engine\")","typeGuard":null,"tryCatchPattern":"from docling.datamodel.settings import settings  # OperationNotAllowed lives in doclingcore exceptions in some versions\ntry:\n    engine = ApiKserveV2ObjectDetectionEngine(enable_remote_services=opts.enable_remote_services, options=engine_opts)\nexcept OperationNotAllowed as e:\n    raise ConfigurationError(f\"Remote services disabled: {e}\") from e","preventionTips":["Treat enable_remote_services=True as a deliberate security decision; default to local engines.","Centralize pipeline option construction in one config function so the flag is set in exactly one place.","Add a startup check that fails fast when a remote engine type is configured without the flag."],"tags":["remote-services","configuration","kserve","object-detection","security"],"backgroundTag":null,"analyzedSha":"61d76f1ff3f8428065465889f7b4577da7df704c","analyzedAt":"2026-08-14T23:53:18.727Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}