opendatalab/MinerU · error · ValueError
Local path for repo_mode '{repo_mode}' is not configured.
Error message
Local path for repo_mode '{repo_mode}' is not configured. What it means
Raised by auto_download_and_get_model_root_path() when the resolved model source is 'local' but the config's local-models directory mapping has no entry for the requested repo_mode. With model-source local, MineRU never downloads; it reads pre-downloaded model trees from a config section (via get_local_models_dir()) keyed by 'pipeline' and 'vlm'. A missing key means the deployment told MineRU to use local models without saying where they are.
Source
Thrown at mineru/utils/models_download_utils.py:294
return cache_dir
def auto_download_and_get_model_root_path(relative_path: str, repo_mode='pipeline') -> str:
"""
支持文件或目录的可靠下载。
- 如果输入文件: 返回本地文件绝对路径
- 如果输入目录: 返回本地缓存下与 relative_path 同结构的相对路径字符串
:param repo_mode: 指定仓库模式,'pipeline' 或 'vlm'
:param relative_path: 文件或目录相对路径
:return: 本地文件绝对路径或相对路径
"""
model_source = resolve_model_source()
if model_source == 'local':
local_models_config = get_local_models_dir()
root_path = local_models_config.get(repo_mode, None)
if not root_path:
raise ValueError(f"Local path for repo_mode '{repo_mode}' is not configured.")
return root_path
# 建立仓库模式到路径的映射
repo_mapping = {
'pipeline': {
'huggingface': ModelPath.pipeline_root_hf,
'modelscope': ModelPath.pipeline_root_modelscope
},
'vlm': {
'huggingface': ModelPath.vlm_root_hf,
'modelscope': ModelPath.vlm_root_modelscope
}
}
if repo_mode not in repo_mapping:
raise ValueError(f"Unsupported repo_mode: {repo_mode}, must be 'pipeline' or 'vlm'")
# model_source 已解析为实际远端来源后,再选择对应仓库。View on GitHub (pinned to 4fe4bde114)
Solutions
- Add the missing mapping to the config so both modes you use point at real directories: {"models-dir": {"pipeline": "/data/models/pipeline", "vlm": "/data/models/vlm"}} (adjust keys to your MineRU version's models-dir schema).
- Verify the directories actually contain the model files for that mode (layout mirrors the Hugging Face snapshot structure).
- Alternatively download once with a remote source (modelsource/huggingface) so MineRU populates its config, then switch to local.
- Confirm MINERU_MODEL_SOURCE=local is intentional — if network access exists, unsetting it removes the local-config requirement.
Example fix
// before
export MINERU_MODEL_SOURCE=local
// mineru.json has no "models-dir" (or only pipeline) entry
// after
// mineru.json
"models-dir": {
"pipeline": "/data/models/pipeline",
"vlm": "/data/models/vlm"
} Defensive patterns
Strategy: validation
Validate before calling
import json, os
cfg = json.load(open(os.path.expanduser('~/mineru.json')))
models_dir = cfg.get('models-dir', {})
needed = {'pipeline'} # add 'vlm' if you use the vlm backend
missing = needed - set(models_dir)
assert not missing, f'models-dir missing entries for: {missing} while using local model source' Type guard
def local_paths_configured(cfg: dict, modes: set[str]) -> bool:
md = cfg.get('models-dir') or {}
return all(isinstance(md.get(m), str) and os.path.isdir(md[m]) for m in modes) Try / catch
try:
root = auto_download_and_get_model_root_path(rel, repo_mode='vlm')
except ValueError as e:
if 'not configured' in str(e):
raise SystemExit('model-source=local but models-dir[vlm] missing in mineru.json') from e
raise Prevention
- When running offline, preflight-check that models-dir contains an entry (and real directory) for every backend you will start.
- Pre-download models once on a connected machine and ship the cache plus config together.
- Keep the models-dir mapping and the MINERU_MODEL_SOURCE value in the same deployment unit so they cannot drift.
When it happens
Trigger: Setting MINERU_MODEL_SOURCE=local (or model-source: local in config) without configuring local_models_dir / the models-dir mapping for the mode being used — e.g. only 'pipeline' is configured but a VLM parse path requests repo_mode='vlm'.
Common situations: Air-gapped or offline deployments that preload models onto disk but copy an incomplete config; enabling local source to avoid network calls while forgetting the vlm entry; the models were downloaded under a different user/home so the config was never written.
Related errors
- {MODEL_SOURCE_ENV_VAR}=auto is not supported. Unset {MODEL_S
- model source auto is only supported for internal default det
- Timed out waiting for local worker {server_id} to become hea
- ak, sk or endpoint not found in {CONFIG_FILE_NAME}
- Invalid MINERU_API_MAX_CONCURRENT_REQUESTS value: {value}. E
AI-assisted analysis of opendatalab/MinerU@4fe4bde114 (2026-08-14).
Data as JSON: /api/errors/6a554b45ac739326.
Report an issue: GitHub.