{"record":{"id":"174a1e6591f81062","repo":"docling-project/docling","slug":"image-processor-config-not-found-preprocessor-co","errorCode":null,"errorMessage":"Image processor config not found: {preprocessor_config}","messagePattern":"Image processor config not found: (.+?)","errorType":"exception","errorClass":"FileNotFoundError","httpStatus":null,"severity":"error","filePath":"docling/models/inference_engines/common/hf_vision_base.py","lineNumber":79,"sourceCode":"                repo_id=download_repo_id,\n                revision=download_revision,\n                local_dir=None,\n                force=False,\n                progress=False,\n            )\n\n        return resolve_model_artifacts_path(\n            repo_id=repo_id,\n            revision=revision,\n            artifacts_path=self._artifacts_path,\n            download_fn=download_wrapper,\n        )\n\n    def _load_preprocessor(self, model_folder: Path) -> BaseImageProcessor:\n        \"\"\"Load HuggingFace image processor from model folder.\"\"\"\n        preprocessor_config = model_folder / \"preprocessor_config.json\"\n        if not preprocessor_config.exists():\n            raise FileNotFoundError(\n                f\"Image processor config not found: {preprocessor_config}\"\n            )\n\n        try:\n            from transformers import AutoImageProcessor\n\n            _log.debug(\"Loading image processor from %s\", model_folder)\n            return AutoImageProcessor.from_pretrained(str(model_folder))\n        except Exception as exc:\n            raise RuntimeError(\n                f\"Failed to load image processor from {model_folder}: {exc}\"\n            )\n\n    def _load_label_mapping(self, model_folder: Path) -> Dict[int, str]:\n        \"\"\"Load label mapping from HuggingFace model config.\"\"\"\n        try:\n            from transformers import AutoConfig\n","sourceCodeStart":61,"sourceCodeEnd":97,"githubUrl":"https://github.com/docling-project/docling/blob/61d76f1ff3f8428065465889f7b4577da7df704c/docling/models/inference_engines/common/hf_vision_base.py#L61-L97","documentation":"Raised as FileNotFoundError by HfVisionModelMixin._load_preprocessor when the resolved model folder does not contain preprocessor_config.json. The HF image processor cannot be constructed without that file, so this is a hard precondition before any image preprocessing.","triggerScenarios":"The resolved artifacts folder (HF cache snapshot, local artifacts_path, or downloaded revision) lacks preprocessor_config.json — e.g. an incomplete download/copy, or pointing artifacts_path at a folder that only holds weights.","commonSituations":"Manual copy of a model repo that skipped config files; interrupted HF download leaving a partial snapshot; artifacts_path pointing at the wrong directory level; a repo revision that genuinely does not ship a preprocessor config.","solutions":["Verify the printed path actually contains the model files; if it is a wrong directory, fix artifacts_path or repo_id/revision.","Re-download the model (delete the partial snapshot / clear the HF cache for that repo) so preprocessor_config.json is fetched.","If you curate the folder manually, copy preprocessor_config.json (and config.json) from the HF repo alongside the weights."],"exampleFix":"# before\naccelerator_opts = ...\nmodel = MyLayoutModel(...)  # artifacts_path='/models/layout' missing config\n\n# after\n# ensure the folder has the file:\n# ls /models/layout/preprocessor_config.json\n# if missing: huggingface-cli download <repo_id> --local-dir /models/layout","handlingStrategy":"validation","validationCode":"from pathlib import Path\nfolder = Path(artifacts_path) if artifacts_path else hf_snapshot_dir(repo_id, revision)\nif not (folder / 'preprocessor_config.json').exists():\n    raise FileNotFoundError(f'{folder} lacks preprocessor_config.json; re-download {repo_id}')","typeGuard":null,"tryCatchPattern":"try:\n    model = MyVisionModel(...)\nexcept FileNotFoundError as e:\n    if 'preprocessor_config' in str(e):\n        redownload(repo_id)  # then retry once\n        model = MyVisionModel(...)\n    else:\n        raise","preventionTips":["Pre-download models in Dockerfiles / provisioning scripts so runtime never resolves artifacts.","Verify the HF snapshot contains preprocessor_config.json after copying caches.","Pin a revision and keep the cache warm; do not hand-trim cache folders."],"tags":["huggingface","model-loading","artifacts","file-not-found"],"backgroundTag":null,"analyzedSha":"61d76f1ff3f8428065465889f7b4577da7df704c","analyzedAt":"2026-08-14T23:53:18.727Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}