opendatalab/MinerU · error · ValueError
Unsupported middle json backend for client-side output gener
Error message
Unsupported middle json backend for client-side output generation: {backend} What it means
ValueError from _select_union_make(): client-side output generation dispatches markdown/content-list rendering by the middle-json's backend tag, and the backend must be one of the supported families (pipeline -> pipeline_middle_json_mkcontent, vlm/hybrid -> vlm module, office -> office module). Anything else cannot be rendered locally.
Source
Thrown at mineru/cli/client_side_output.py:31
SUPPORTED_BACKENDS = {*PDF_BACKENDS, "office"}
def _select_union_make(backend: str) -> Callable[[list, str, str], Any]:
"""根据 middle json 后端选择对应的 Markdown/content list 渲染函数。"""
if backend == "pipeline":
from mineru.backend.pipeline.pipeline_middle_json_mkcontent import union_make
return union_make
if backend in {"vlm", "hybrid"}:
from mineru.backend.vlm.vlm_middle_json_mkcontent import union_make
return union_make
if backend == "office":
from mineru.backend.office.office_middle_json_mkcontent import union_make
return union_make
raise ValueError(
f"Unsupported middle json backend for client-side output generation: {backend}"
)
def _write_json(path: Path, payload: Any) -> None:
"""按项目现有格式写入 JSON 文件,保持中文内容可读。"""
path.write_text(
json.dumps(payload, ensure_ascii=False, indent=4),
encoding="utf-8",
)
def regenerate_client_side_outputs(
parse_dir: str | Path,
doc_stem: str,
) -> tuple[Path, ...]:
"""读取服务端 staged/finalized middle json,并在客户端覆盖生成最终输出产物。"""
parse_dir = Path(parse_dir)View on GitHub (pinned to 4fe4bde114)
Solutions
- Regenerate the middle json with the current mineru version so _backend is one of pipeline/vlm/hybrid/office
- If editing middle.json manually, keep _backend intact and valid
- Re-download the artifacts from the server instead of reusing stale local staged files
- Pin matching versions between the server that produced the json and the client that renders it
Example fix
# before: stale middle json with "_backend": "vlm-auto-engine" # after: regenerate via the server, yielding "_backend": "vlm"
Defensive patterns
Strategy: validation
Validate before calling
SUPPORTED = {"pipeline", "vlm", "hybrid", "office"}
backend = json.loads(middle_json_path.read_text(encoding="utf-8")).get("_backend")
if backend not in SUPPORTED:
raise SystemExit(f"Cannot render middle json: backend {backend!r} not supported; regenerate artifacts with this mineru version") Type guard
def is_renderable_middle_json(payload: object) -> bool:
return (
isinstance(payload, dict)
and payload.get("_backend") in {"pipeline", "vlm", "hybrid", "office"}
and isinstance(payload.get("pdf_info"), list)
) Try / catch
try:
regenerate_client_side_outputs(parse_dir, doc_stem)
except ValueError as e:
if "Unsupported middle json backend" in str(e):
# artifacts are stale — refetch from server instead of rendering locally
refetch_results()
else:
raise Prevention
- Keep client and server mineru versions aligned
- Never edit _backend in staged middle.json files
- Regenerate rather than patch stale local artifacts
When it happens
Trigger: Calling regenerate_client_side_outputs() (indirectly via client-side output generation after a parse) where the staged {doc}_middle.json has _backend set to an unexpected value such as an old backend name or a hand-edited/custom tag.
Common situations: Middle-json files produced by an older mineru version whose _backend tags differ; users editing or post-processing middle.json and changing/removing _backend; mixing outputs from forks that add backend families.
Related errors
- Missing middle json file: {middle_json_path}
- middle_json must be a dict.
- middle_json must contain a list field named pdf_info.
- backend={backend} requires server_url
- Please install transformers to use the transformers backend.
AI-assisted analysis of opendatalab/MinerU@4fe4bde114 (2026-08-14).
Data as JSON: /api/errors/b57556b0642f5e98.
Report an issue: GitHub.