{"record":{"id":"1b6e7fce8ddd802e","repo":"docling-project/docling","slug":"type-self-name-requires-model-config-with-r","errorCode":null,"errorMessage":"{type(self).__name__} requires model_config with repo_id","messagePattern":"(.+?) requires model_config with repo_id","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"docling/models/inference_engines/common/hf_vision_base.py","lineNumber":36,"sourceCode":"\n    from docling.datamodel.stage_model_specs import EngineModelConfig\n\n_log = logging.getLogger(__name__)\n\n\nclass HfVisionModelMixin(HuggingFaceModelDownloadMixin):\n    \"\"\"Shared utility mixin for HF vision model loading and label conversion.\"\"\"\n\n    def _init_hf_vision_model(\n        self,\n        *,\n        model_config: Optional[EngineModelConfig],\n        accelerator_options: AcceleratorOptions,\n        artifacts_path: Optional[Union[Path, str]],\n        model_family_name: str,\n    ) -> None:\n        if model_config is None or model_config.repo_id is None:\n            raise ValueError(\n                f\"{type(self).__name__} requires model_config with repo_id\"\n            )\n\n        self._model_config: EngineModelConfig = model_config\n        self._repo_id: str = model_config.repo_id\n        self._accelerator_options = accelerator_options\n        self._artifacts_path = (\n            artifacts_path if artifacts_path is None else Path(artifacts_path)\n        )\n        self._model_family_name = model_family_name\n        self._processor: Optional[BaseImageProcessor] = None\n        self._id_to_label: Dict[int, str] = {}\n\n    def _resolve_model_folder(self, repo_id: str, revision: str) -> Path:\n        \"\"\"Resolve model folder from artifacts_path or HF download.\"\"\"\n\n        def download_wrapper(download_repo_id: str, download_revision: str) -> Path:\n            _log.info(","sourceCodeStart":18,"sourceCodeEnd":54,"githubUrl":"https://github.com/docling-project/docling/blob/61d76f1ff3f8428065465889f7b4577da7df704c/docling/models/inference_engines/common/hf_vision_base.py#L18-L54","documentation":"Raised by HfVisionModelMixin._init_hf_vision_model when the engine model config is None or has no repo_id. HF-backed vision inference engines resolve their weights from a Hugging Face repo id; without it the model cannot be downloaded or located locally.","triggerScenarios":"Constructing a KServe/HF vision inference model whose EngineModelConfig lacks repo_id (e.g. only artifacts_path or a remote URL was configured), or passing model_config=None.","commonSituations":"Switching a model family from a remote inference endpoint to local HF weights and forgetting to set repo_id in the model config; YAML/pydantic config where repo_id field is omitted; copy-pasting a remote-engine config for an HF-backed engine.","solutions":["Set repo_id on the model config to a valid Hugging Face model repository, e.g. 'ds4sd/docling-layout'.","If you intended to run fully remote inference, use the remote engine/config variant instead of the HF-backed one.","If you meant to use a local snapshot, still set repo_id (it keys the local cache) or supply the resolved artifacts_path alongside it."],"exampleFix":"# before\nmodel_config = EngineModelConfig(repo_id=None, artifacts_path='/models/layout')\n\n# after\nmodel_config = EngineModelConfig(repo_id='ds4sd/docling-layout', artifacts_path='/models/layout')","handlingStrategy":"validation","validationCode":"if model_config is None or not model_config.repo_id:\n    raise ValueError('EngineModelConfig.repo_id is required for HF vision engines')","typeGuard":"def has_repo_id(model_config) -> bool:\n    return model_config is not None and bool(getattr(model_config, 'repo_id', None))","tryCatchPattern":null,"preventionTips":["Validate engine model configs at settings-load time, not at model construction.","Use pydantic validators on your config model to require repo_id for HF engines.","Integration-test the smallest conversion to catch missing config early."],"tags":["configuration","huggingface","inference-engine","model-loading"],"backgroundTag":null,"analyzedSha":"61d76f1ff3f8428065465889f7b4577da7df704c","analyzedAt":"2026-08-14T23:53:18.727Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}