opendatalab/MinerU · error · ValueError
Invalid effort. Allowed values: {allowed_values}
Error message
Invalid effort. Allowed values: {allowed_values} What it means
ValueError from validate_effort(): the hybrid effort parameter must be exactly 'medium' or 'high' (HYBRID_EFFORT_CHOICES). This is the CLI-side twin of the API check, raised before any parsing work starts.
Source
Thrown at mineru/cli/backend_options.py:57
def normalize_backend(backend: str) -> str:
"""将旧 backend 别名规范为当前公开名称,并校验最终名称是否合法。"""
normalized_backend = LEGACY_BACKEND_ALIASES.get(backend, backend)
if normalized_backend not in PUBLIC_BACKEND_CHOICES:
allowed_values = ", ".join(PUBLIC_BACKEND_CHOICES)
raise ValueError(f"Invalid backend. Allowed values: {allowed_values}")
return normalized_backend
def validate_backend(backend: str) -> str:
"""校验公开入口允许的 backend 名称,并返回规范后的后端名称。"""
return normalize_backend(backend)
def validate_effort(effort: str) -> str:
"""校验公开 hybrid effort 参数,并返回规范后的 effort 名称。"""
if effort not in HYBRID_EFFORT_CHOICES:
allowed_values = ", ".join(HYBRID_EFFORT_CHOICES)
raise ValueError(f"Invalid effort. Allowed values: {allowed_values}")
return effort
View on GitHub (pinned to 4fe4bde114)
Solutions
- Use 'medium' or 'high' (lowercase, exact)
- Omit the flag to fall back to DEFAULT_HYBRID_EFFORT='medium'
- Confirm choices via HYBRID_EFFORT_CHOICES in mineru/cli/backend_options.py for your version
Example fix
# before mineru -p doc.pdf -b hybrid-engine --effort low # after mineru -p doc.pdf -b hybrid-engine --effort medium
Defensive patterns
Strategy: validation
Validate before calling
from mineru.cli.backend_options import HYBRID_EFFORT_CHOICES, validate_effort effort = validate_effort((effort or "medium").strip().lower())
Type guard
def is_valid_effort(v: str | None) -> bool:
return v is None or v in {"medium", "high"} Prevention
- Default effort to 'medium' in wrappers instead of propagating user input blindly
- Lowercase and strip user input before validation
- Expose only medium/high in your own UI dropdowns
When it happens
Trigger: Running a hybrid backend with an effort flag like 'low', 'ultra', 'auto', or 'MEDIUM'; passing effort to a non-hybrid backend where it is later validated anyway.
Common situations: Users porting settings from other LLM tools that have low/medium/high tiers; typos; environment-specific configs written against a fork with more tiers.
Related errors
- effort must be "medium" or "high"
- Invalid effort. Allowed values: {allowed_values}
- Unsupported hybrid effort: {effort}
- Invalid backend. Allowed values: {allowed_values}
- max_concurrent_requests must be a positive integer
AI-assisted analysis of opendatalab/MinerU@4fe4bde114 (2026-08-14).
Data as JSON: /api/errors/1c938e578e5fc01a.
Report an issue: GitHub.