{"record":{"id":"014c6140abe0646f","repo":"docling-project/docling","slug":"unsupported-engine-type-preset-default-engine-typ","errorCode":null,"errorMessage":"Unsupported engine type {preset.default_engine_type} for presets","messagePattern":"Unsupported engine type (.+?) for presets","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"docling/datamodel/stage_model_specs.py","lineNumber":785,"sourceCode":"            TransformersObjectDetectionEngineOptions,\n        )\n\n        preset = cls.get_preset(preset_id)\n\n        if engine_options is None:\n            if preset.default_engine_type == ObjectDetectionEngineType.ONNXRUNTIME:\n                engine_options = OnnxRuntimeObjectDetectionEngineOptions()\n            elif preset.default_engine_type == ObjectDetectionEngineType.TRANSFORMERS:\n                engine_options = TransformersObjectDetectionEngineOptions()\n            elif preset.default_engine_type == ObjectDetectionEngineType.API_KSERVE_V2:\n                raise ValueError(\n                    f\"Preset '{preset_id}' uses API_KSERVE_V2 engine which requires explicit \"\n                    \"engine_options with a 'url' parameter. Please provide \"\n                    \"engine_options=ApiKserveV2ObjectDetectionEngineOptions(url='...') \"\n                    \"when calling from_preset().\"\n                )\n            else:\n                raise ValueError(\n                    f\"Unsupported engine type {preset.default_engine_type} for presets\"\n                )\n\n        instance = cls(  # type: ignore[call-arg]\n            model_spec=preset.model_spec,\n            engine_options=engine_options,\n            **preset.stage_options,\n        )\n\n        for key, value in overrides.items():\n            setattr(instance, key, value)\n\n        return instance\n\n\nclass ImageClassificationStagePreset(BaseModel):\n    \"\"\"Preset definition for image classification-powered stages.\"\"\"\n","sourceCodeStart":767,"sourceCodeEnd":803,"githubUrl":"https://github.com/docling-project/docling/blob/61d76f1ff3f8428065465889f7b4577da7df704c/docling/datamodel/stage_model_specs.py#L767-L803","documentation":"In ObjectDetectionStage.from_preset, if engine_options is None and the preset's default_engine_type matches none of ONNXRUNTIME, TRANSFORMERS, or API_KSERVE_V2, a ValueError is raised stating the engine type is unsupported. This is a defensive exhaustiveness check: it normally indicates a new enum value added to ObjectDetectionEngineType without a corresponding branch here, or a corrupt/custom preset definition.","triggerScenarios":"A preset registered with default_engine_type set to a value outside the three handled enum members, then from_preset(preset_id) called without engine_options. Users who pass engine_options explicitly bypass all branches and never hit this.","commonSituations":"Custom presets built with a newly added or experimental engine enum value; version skew between docling packages where the enum knows more values than from_preset handles.","solutions":["Pass explicit engine_options matching your engine so no default branch is needed.","If registering the preset yourself, set default_engine_type to ONNXRUNTIME, TRANSFORMERS, or API_KSERVE_V2.","If a legitimate new engine value hits this, report it upstream — the branch list is missing a case."],"exampleFix":"# before\nstage = ObjectDetectionStage.from_preset(\"custom_preset\")  # preset has exotic engine\n\n# after\nstage = ObjectDetectionStage.from_preset(\n    \"custom_preset\",\n    engine_options=OnnxRuntimeObjectDetectionEngineOptions(),\n)","handlingStrategy":"try-catch","validationCode":"SUPPORTED_OD_ENGINES = {ObjectDetectionEngineType.ONNXRUNTIME, ObjectDetectionEngineType.TRANSFORMERS, ObjectDetectionEngineType.API_KSERVE_V2}\nif engine_options is None and preset.default_engine_type not in SUPPORTED_OD_ENGINES:\n    engine_options = OnnxRuntimeObjectDetectionEngineOptions()  # explicit safe choice","typeGuard":null,"tryCatchPattern":"try:\n    stage = ObjectDetectionStage.from_preset(pid)\nexcept ValueError as e:\n    if \"Unsupported engine type\" in str(e):\n        stage = ObjectDetectionStage.from_preset(pid, engine_options=OnnxRuntimeObjectDetectionEngineOptions())\n    else:\n        raise","preventionTips":["Pin docling versions so enum values and from_preset branches stay in sync.","Prefer explicit engine_options when using custom presets."],"tags":["engine-type","preset","exhaustiveness","object-detection","internal-error"],"backgroundTag":null,"analyzedSha":"61d76f1ff3f8428065465889f7b4577da7df704c","analyzedAt":"2026-08-14T23:53:18.727Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}