{"record":{"id":"3e7d8bf9c8dd2de9","repo":"opendatalab/MinerU","slug":"unknown-backend-type-backend","errorCode":null,"errorMessage":"Unknown backend type: {backend}","messagePattern":"Unknown backend type: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"mineru/cli/output_paths.py","lineNumber":26,"sourceCode":"\ndef build_parse_dir(\n    output_dir: str | Path,\n    pdf_name: str,\n    backend: str,\n    parse_method: str,\n    *,\n    is_office: bool = False,\n) -> Path:\n    output_root = Path(output_dir)\n    if is_office:\n        return output_root / pdf_name / OFFICE_PARSE_DIR_NAME\n    if backend.startswith(\"pipeline\"):\n        return output_root / pdf_name / parse_method\n    if backend.startswith(\"vlm\"):\n        return output_root / pdf_name / VLM_PARSE_DIR_NAME\n    if backend.startswith(\"hybrid\"):\n        return output_root / pdf_name / f\"hybrid_{parse_method}\"\n    raise ValueError(f\"Unknown backend type: {backend}\")\n\n\ndef resolve_parse_dir(\n    output_dir: str | Path,\n    pdf_name: str,\n    backend: str,\n    parse_method: str,\n    *,\n    is_office: bool = False,\n    allow_office_fallback: bool = False,\n) -> Path:\n    parse_dir = build_parse_dir(\n        output_dir,\n        pdf_name,\n        backend,\n        parse_method,\n        is_office=is_office,\n    )","sourceCodeStart":8,"sourceCodeEnd":44,"githubUrl":"https://github.com/opendatalab/MinerU/blob/4fe4bde114a23ee5dd637eae99b767f4669bf58c/mineru/cli/output_paths.py#L8-L44","documentation":"ValueError raised by build_parse_dir in mineru/cli/output_paths.py: the backend string must start with 'pipeline', 'vlm', or 'hybrid' (prefix matching, so 'vlm-engine' etc. pass), otherwise the output directory layout is undefined and the function refuses. The backend value typically comes from the CLI --backend flag or API request options, so this is usually a user-supplied string validation failure.","triggerScenarios":"Running the CLI or API with --backend txt, --backend auto, or a typo like 'pipiline'/'vlmm'; programmatic callers passing backend='none'; values with wrong casing ('Pipeline') since startswith is case-sensitive.","commonSituations":"Copy-pasting commands from docs of a different mineru version that had other backend names; shell-quoting mistakes leaving a stray character in the value; wrapper scripts mapping their own backend names without translating them.","solutions":["Use one of the supported backends: pipeline (optionally with a '-...' subtag), vlm, or hybrid.","Check for typos, casing, and stray whitespace/quotes in the --backend value.","If you need a custom backend name, map it to a supported prefix before calling output-path helpers (e.g. 'my_vlm' -> 'vlm' for layout purposes).","Upgrade mineru if you expected a newer backend name (e.g. hybrid) to exist."],"exampleFix":"# before\nsubprocess.run(['mineru', '-p', 'file.pdf', '-b', 'auto'])  # ValueError: Unknown backend type: auto\n\n# after\nsubprocess.run(['mineru', '-p', 'file.pdf', '-b', 'hybrid'])  # or 'pipeline' / 'vlm'","handlingStrategy":"validation","validationCode":"ALLOWED_BACKEND_PREFIXES = ('pipeline', 'vlm', 'hybrid')\n\ndef normalize_backend(backend: str) -> str:\n    b = backend.strip().lower()\n    if not b.startswith(ALLOWED_BACKEND_PREFIXES):\n        raise ValueError(f\"backend must start with one of {ALLOWED_BACKEND_PREFIXES}, got {backend!r}\")\n    return b","typeGuard":"def is_supported_backend(backend: str) -> bool:\n    return isinstance(backend, str) and backend.strip().lower().startswith(('pipeline', 'vlm', 'hybrid'))","tryCatchPattern":null,"preventionTips":["Expose backend choice as an enum in wrappers and CLI argparsers (choices=['pipeline','vlm','hybrid']).","Normalize case and strip whitespace before passing user input downstream."],"tags":["mineru","cli","backend-selection","validation","output-paths"],"backgroundTag":null,"analyzedSha":"4fe4bde114a23ee5dd637eae99b767f4669bf58c","analyzedAt":"2026-08-14T21:29:18.456Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}