{"record":{"id":"a668c19e7c845f64","repo":"infiniflow/ragflow","slug":"docgenerator-font-size-must-be-greater-than-or-e","errorCode":null,"errorMessage":"[DocGenerator] Font size must be greater than or equal to 12","messagePattern":"\\[DocGenerator\\] Font size must be greater than or equal to 12","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"agent/component/docs_generator.py","lineNumber":72,"sourceCode":"        self.font_size = 12\n        self.outputs = {\n            \"doc_id\": {\"value\": \"\", \"type\": \"string\"},\n            \"filename\": {\"value\": \"\", \"type\": \"string\"},\n            \"mime_type\": {\"value\": \"\", \"type\": \"string\"},\n            \"size\": {\"value\": 0, \"type\": \"number\"},\n            \"download\": {\"value\": \"\", \"type\": \"string\"},\n        }\n\n    def check(self):\n        self.check_empty(self.content, \"[DocGenerator] Content\")\n        self.check_valid_value(\n            self.output_format,\n            \"[DocGenerator] Output format\",\n            [\"pdf\", \"docx\", \"txt\", \"markdown\", \"html\"],\n        )\n        self.check_positive_number(self.font_size, \"[DocGenerator] Font size\")\n        if self.font_size < 12:\n            raise ValueError(\"[DocGenerator] Font size must be greater than or equal to 12\")\n\n\nclass DocGenerator(Message, ABC):\n    component_name = \"DocGenerator\"\n    _default_output_directory = os.path.join(tempfile.gettempdir(), \"doc_outputs\")\n    _overlay_margin = 36\n    _overlay_font_size = 9\n    _pdf_main_font = \"Noto Sans CJK SC\"\n    _pdf_cjk_font = \"Noto Sans CJK SC\"\n    _pdf_overlay_font = \"STSong-Light\"\n\n    def get_input_form(self) -> dict[str, dict]:\n        return {\n            \"content\": {\n                \"name\": \"Content\",\n                \"type\": \"text\",\n            }\n        }","sourceCodeStart":54,"sourceCodeEnd":90,"githubUrl":"https://github.com/infiniflow/ragflow/blob/554fb1133ac3861732235ad9c377eb5e0a770665/agent/component/docs_generator.py#L54-L90","documentation":"Raised by DocGeneratorParam.check (agent/component/docs_generator.py) after check_positive_number passes: font_size is numeric and positive but below the enforced minimum of 12. The floor exists because generated documents render an overlay/footer and smaller sizes produce unreadable or mis-rendered output with the bundled PDF/DOCX pipeline.","triggerScenarios":"Setting the DocGenerator component's font_size to any positive value less than 12 (e.g. 9, 10.5, 11) in the canvas configuration. Fires during parameter validation when the component is saved or the agent runs.","commonSituations":"Users wanting compact documents setting 10 or 11; defaults from templates built for other generators; copying a font size from a CSS/web context where 10-14px is normal.","solutions":["Set font_size to 12 or higher (e.g. 12, 14) in the DocGenerator component settings","If smaller text is truly needed, adjust the document content/template instead of the generator font size","Programmatically clamp: font_size = max(12, font_size)"],"exampleFix":"# before\n\"font_size\": 10\n\n# after\n\"font_size\": 12","handlingStrategy":"validation","validationCode":"font_size = config.get('font_size', 12)\nif not isinstance(font_size, (int, float)) or font_size < 12:\n    font_size = 12  # enforce generator minimum\nparam.font_size = font_size","typeGuard":"def is_valid_font_size(v) -> bool:\n    return isinstance(v, (int, float)) and not isinstance(v, bool) and v >= 12","tryCatchPattern":"try:\n    param.check()\nexcept ValueError as e:\n    if 'Font size' in str(e):\n        param.font_size = 12\n    else:\n        raise","preventionTips":["Treat 12 as the hard minimum in any DocGenerator config UI","Clamp imported/template font sizes with max(12, value)","Adjust document density via content, not sub-12 fonts"],"tags":["validation","agent-component","doc-generator","configuration"],"backgroundTag":null,"analyzedSha":"554fb1133ac3861732235ad9c377eb5e0a770665","analyzedAt":"2026-08-15T09:20:16.380Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}