{"record":{"id":"22d601628f3b1cd8","repo":"docling-project/docling","slug":"onnx-model-file-model-filename-not-found-mod-22d601","errorCode":null,"errorMessage":"ONNX model file '{model_filename}' not found: {model_path}","messagePattern":"ONNX model file '(.+?)' not found: (.+?)","errorType":"exception","errorClass":"FileNotFoundError","httpStatus":null,"severity":"error","filePath":"docling/models/inference_engines/object_detection/onnxruntime_engine.py","lineNumber":84,"sourceCode":"\n    def _resolve_model_artifacts(self) -> tuple[Path, Path]:\n        \"\"\"Resolve model artifacts from artifacts_path or HF download.\n\n        Returns:\n            Tuple of (model_folder, model_path)\n        \"\"\"\n        repo_id = self._repo_id\n        revision = self._model_config.revision or \"main\"\n\n        model_filename = self._resolve_model_filename()\n        model_folder = self._resolve_model_folder(\n            repo_id=repo_id,\n            revision=str(revision),\n        )\n        model_path = model_folder / model_filename\n\n        if not model_path.exists():\n            raise FileNotFoundError(\n                f\"ONNX model file '{model_filename}' not found: {model_path}\"\n            )\n\n        return model_folder, model_path\n\n    def _resolve_model_filename(self) -> str:\n        \"\"\"Determine which ONNX filename to load.\"\"\"\n        filename = self.options.model_filename\n        extra_filename = self._model_config.extra_config.get(\"model_filename\")\n        if extra_filename and isinstance(extra_filename, str):\n            filename = extra_filename\n        return filename\n\n    def initialize(self) -> None:\n        \"\"\"Initialize ONNX session and preprocessor.\"\"\"\n        import onnxruntime as ort\n\n        _log.info(\"Initializing ONNX Runtime object-detection engine\")","sourceCodeStart":66,"sourceCodeEnd":102,"githubUrl":"https://github.com/docling-project/docling/blob/61d76f1ff3f8428065465889f7b4577da7df704c/docling/models/inference_engines/object_detection/onnxruntime_engine.py#L66-L102","documentation":"The ONNX Runtime engine resolves the model directory (HF cache or artifacts_path plus repo folder) and appends the model filename; if that file does not exist on disk it raises FileNotFoundError with the exact expected path. The filename comes from options.model_filename unless overridden by model_config.extra_config['model_filename'].","triggerScenarios":"Running with --artifacts-path pointing at a directory that lacks the model repo subfolder or the specific .onnx file; an artifacts snapshot downloaded for a different model revision; a custom model_filename/extra_config filename that does not match the downloaded artifact.","commonSituations":"Air-gapped/offline deployments with pre-populated artifacts_path missing one file; partial/interrupted downloads; case-sensitivity differences of filenames between the download host and Linux filesystems; wrong model_filename in a custom model spec.","solutions":["Check the printed model_path and copy/download the missing .onnx file to exactly that location (docling-tools models download is the usual tool).","Verify artifacts_path contains the repo-id-named subfolder with the revision that matches model_config.revision.","If using a custom filename, make sure options.model_filename or extra_config['model_filename'] matches the actual file name on disk."],"exampleFix":"# before\n# artifacts dir has model.onnx but spec expects rtdetr_r50vd.onnx\n\n# after\n# either rename the file to match, or point the spec at the real file:\nextra_config = {\"model_filename\": \"model.onnx\"}","handlingStrategy":"validation","validationCode":"from pathlib import Path\nexpected = artifacts_path / repo_id.replace('/', '--') / engine._resolve_model_filename()\nif not expected.exists():\n    raise FileNotFoundError(f\"Pre-check: missing ONNX weights at {expected}\")","typeGuard":null,"tryCatchPattern":"try:\n    engine.initialize()\nexcept FileNotFoundError as e:\n    log.error(\"Model weights missing: %s\", e)\n    raise  # do not fall back silently in offline deployments","preventionTips":["Pre-flight check that every expected model file exists under artifacts_path before starting offline jobs.","Download artifacts with docling-tools into the exact directory you will pass.","Watch filename casing when copying artifacts to case-sensitive filesystems."],"tags":["onnx","file-not-found","artifacts","offline","object-detection"],"backgroundTag":null,"analyzedSha":"61d76f1ff3f8428065465889f7b4577da7df704c","analyzedAt":"2026-08-14T23:53:18.727Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}