{"record":{"id":"fea8e78e65e492e1","repo":"docling-project/docling","slug":"unknown-prompt-style-self-vlm-options-transforme","errorCode":null,"errorMessage":"Unknown prompt style `{self.vlm_options.transformers_prompt_style}`. Valid values are {', '.join(s.value for s in TransformersPromptStyle)}.","messagePattern":"Unknown prompt style `(.+?)`\\. Valid values are (.+?)\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"docling/models/base_model.py","lineNumber":138,"sourceCode":"\n            return prompt\n\n        elif self.vlm_options.transformers_prompt_style == TransformersPromptStyle.CHAT:\n            messages = [\n                {\n                    \"role\": \"user\",\n                    \"content\": [\n                        {\"type\": \"image\"},\n                        {\"type\": \"text\", \"text\": user_prompt},\n                    ],\n                }\n            ]\n            prompt = self.processor.apply_chat_template(\n                messages, add_generation_prompt=True\n            )\n            return prompt\n\n        raise RuntimeError(\n            f\"Unknown prompt style `{self.vlm_options.transformers_prompt_style}`. Valid values are {', '.join(s.value for s in TransformersPromptStyle)}.\"\n        )\n\n\nEnrichElementT = TypeVar(\"EnrichElementT\", default=NodeItem)\n\n\nclass GenericEnrichmentModel(ABC, Generic[EnrichElementT]):\n    elements_batch_size: int = settings.perf.elements_batch_size\n\n    @abstractmethod\n    def is_processable(self, doc: DoclingDocument, element: NodeItem) -> bool:\n        pass\n\n    @abstractmethod\n    def prepare_element(\n        self, conv_res: ConversionResult, element: NodeItem\n    ) -> Optional[EnrichElementT]:","sourceCodeStart":120,"sourceCodeEnd":156,"githubUrl":"https://github.com/docling-project/docling/blob/61d76f1ff3f8428065465889f7b4577da7df704c/docling/models/base_model.py#L120-L156","documentation":"RuntimeError from the transformers-based VLM base model when applying the chat template: vlm_options.transformers_prompt_style does not match any branch of the prompt-style dispatch, i.e. it is not one of the TransformersPromptStyle enum values listed in the message.","triggerScenarios":"Setting transformers_prompt_style to a raw string that does not equal an enum value (e.g. 'chat' vs 'CHATTY') or to a member added in a newer/older transformers-coupled enum than the model code handles.","commonSituations":"Loading options from YAML/JSON where the style string drifted from the enum's exact spelling; upgrading Docling/transformers where prompt-style names changed; copy-pasting a style from another model's docs.","solutions":["Use a TransformersPromptStyle enum member instead of a hand-typed string: vlm_options.transformers_prompt_style = TransformersPromptStyle.CHATTY.","Print ', '.join(s.value for s in TransformersPromptStyle) and correct the value to one of those exact strings.","Regenerate or revalidate serialized option files after upgrading Docling."],"exampleFix":"# before\nvlm_options.transformers_prompt_style = 'chat'  # typo'd raw string\n\n# after\nfrom docling.datamodel.pipeline_options_vlm_model import TransformersPromptStyle\nvlm_options.transformers_prompt_style = TransformersPromptStyle.CHATTY","handlingStrategy":"validation","validationCode":"from docling.datamodel.pipeline_options_vlm_model import TransformersPromptStyle\nvalid = {s.value for s in TransformersPromptStyle}\nassert vlm_options.transformers_prompt_style in valid, f'prompt style must be one of {sorted(valid)}'","typeGuard":"def is_valid_prompt_style(style: str) -> bool:\n    return style in {s.value for s in TransformersPromptStyle}","tryCatchPattern":"try:\n    out = model(...)\nexcept RuntimeError as e:\n    if 'Unknown prompt style' in str(e):\n        vlm_options.transformers_prompt_style = TransformersPromptStyle.CHATTY\n        out = model(...)","preventionTips":["Always set prompt styles via the enum, never free-form strings.","Validate deserialized config values against the enum before constructing model options."],"tags":["vlm","transformers","prompt-style","enum"],"backgroundTag":null,"analyzedSha":"61d76f1ff3f8428065465889f7b4577da7df704c","analyzedAt":"2026-08-14T23:53:18.727Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}