{"record":{"id":"cab5a0a7678c9911","repo":"opendatalab/MinerU","slug":"invalid-latex-delimiters-type-latex-delimiters-t","errorCode":null,"errorMessage":"Invalid latex delimiters type: {latex_delimiters_type}.","messagePattern":"Invalid latex delimiters type: (.+?)\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"mineru/cli/gradio_app.py","lineNumber":1784,"sourceCode":"        return build_interface_updates(backend_choice, effort_choice)\n\n    del kwargs\n    _gradio_local_api_server.configure(\n        resolve_gradio_local_api_cli_args(\n            ctx.args,\n            api_url=api_url,\n            enable_vlm_preload=enable_vlm_preload,\n        )\n    )\n\n    if latex_delimiters_type == 'a':\n        latex_delimiters = latex_delimiters_type_a\n    elif latex_delimiters_type == 'b':\n        latex_delimiters = latex_delimiters_type_b\n    elif latex_delimiters_type == 'all':\n        latex_delimiters = latex_delimiters_type_all\n    else:\n        raise ValueError(f\"Invalid latex delimiters type: {latex_delimiters_type}.\")\n\n\n    async def convert_to_markdown_stream(\n        file_path,\n        end_pages=10,\n        is_ocr=False,\n        formula_enable=True,\n        table_enable=True,\n        image_analysis=True,\n        effort=DEFAULT_HYBRID_EFFORT,\n        language=\"ch\",\n        backend=\"pipeline\",\n        url=None,\n        request: gr.Request = None,\n    ):\n        request_locale = resolve_request_locale(request)\n        async for update in stream_to_markdown(\n            file_path=file_path,","sourceCodeStart":1766,"sourceCodeEnd":1802,"githubUrl":"https://github.com/opendatalab/MinerU/blob/4fe4bde114a23ee5dd637eae99b767f4669bf58c/mineru/cli/gradio_app.py#L1766-L1802","documentation":"ValueError raised in mineru/cli/gradio_app.py when building the Gradio app: the latex_delimiters_type parameter must be exactly 'a', 'b', or 'all' (selecting among latex_delimiters_type_a/b/all presets that control how inline/display math is delimited in output markdown). Any other string — including 'A', 'none', 'default' — hits the else branch. Because it is raised during app construction, it kills the Gradio server at startup, not at request time.","triggerScenarios":"Programmatically instantiating the Gradio app (building the demo object) with latex_delimiters_type='default' or another unsupported value; copying example code from an older/newer mineru version whose accepted values differ; passing a UI dropdown value that was customized.","commonSituations":"Embedding the mineru Gradio app in another tool and guessing parameter names/values; version drift changing the accepted enum; scripts importing the build function directly instead of using the CLI.","solutions":["Set latex_delimiters_type to one of 'a', 'b', or 'all' (case-sensitive, lowercase).","If you do not care about delimiter style, omit the parameter if it has a default in your version.","Check the latex_delimiters_type_a/b/all definitions near the top of gradio_app.py to see which preset each maps to and pick deliberately.","Pin your mineru version so the accepted enum does not shift under you."],"exampleFix":"# before\napp = build_app(latex_delimiters_type='default')  # ValueError\n\n# after\napp = build_app(latex_delimiters_type='all')  # or 'a' / 'b'","handlingStrategy":"type-guard","validationCode":"VALID_LATEX = {'a', 'b', 'all'}\nif latex_delimiters_type not in VALID_LATEX:\n    raise ValueError(f'latex_delimiters_type must be one of {VALID_LATEX}')","typeGuard":"def is_valid_latex_delimiters_type(v: str) -> bool:\n    return isinstance(v, str) and v in {'a', 'b', 'all'}","tryCatchPattern":null,"preventionTips":["Drive this option from a fixed dropdown/enum, never free-text input.","Pin the mineru version when you depend on the Gradio build API signature."],"tags":["mineru","gradio","configuration","latex","validation"],"backgroundTag":null,"analyzedSha":"4fe4bde114a23ee5dd637eae99b767f4669bf58c","analyzedAt":"2026-08-14T21:29:18.456Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}