opendatalab/MinerU · error · ValueError

No supported files found in directory: {path}

Error message

No supported files found in directory: {path}

What it means

Raised by collect_input_files() when input_path is a valid directory but contains zero regular files whose suffix is in SUPPORTED_INPUT_SUFFIXES. Directories are scanned with iterdir(), filtered to supported files, and the resulting list must be non-empty.

Source

Thrown at demo/demo.py:40

        file_suffix = guess_suffix_by_path(path)
        if file_suffix not in SUPPORTED_INPUT_SUFFIXES:
            raise ValueError(f"Unsupported input file type: {path.name}")
        return [path]

    if not path.is_dir():
        raise ValueError(f"Input path must be a file or directory: {path}")

    input_files = sorted(
        (
            candidate.resolve()
            for candidate in path.iterdir()
            if candidate.is_file()
            and guess_suffix_by_path(candidate) in SUPPORTED_INPUT_SUFFIXES
        ),
        key=lambda item: item.name,
    )
    if not input_files:
        raise ValueError(f"No supported files found in directory: {path}")
    return input_files


def build_form_data(
    language: str,
    backend: str,
    parse_method: str,
    formula_enable: bool,
    table_enable: bool,
    server_url: str | None,
    start_page_id: int,
    end_page_id: int | None,
    image_analysis: bool = True,
    effort: str = "medium",
) -> dict[str, str | list[str]]:
    return _api_client.build_parse_request_form_data(
        lang_list=[language],
        backend=backend,

View on GitHub (pinned to 4fe4bde114)

Solutions

  1. List the directory contents and confirm at least one .pdf/.image/.office file is present.
  2. Point input_path at the directory that actually holds the converted PDFs.
  3. Convert unsupported files to PDF in place before invoking MinerU.

Example fix

# before
files = collect_input_files("./out")  # empty dir

# after
from pathlib import Path
src = Path("./converted")
if not any(p.suffix.lower() in {".pdf", ".png", ".jpg", ".docx"} for p in src.iterdir()):
    raise SystemExit(f"no supported files in {src}")
files = collect_input_files(str(src))
Defensive patterns

Strategy: validation

Validate before calling

from pathlib import Path
from mineru.cli.common import pdf_suffixes, image_suffixes, office_suffixes

ALLOWED = set(pdf_suffixes + image_suffixes + office_suffixes)

def has_supported_files(directory: str) -> bool:
    d = Path(directory)
    return d.is_dir() and any(
        c.is_file() and c.suffix.lower() in ALLOWED for c in d.iterdir()
    )

Try / catch

try:
    files = collect_input_files(directory)
except ValueError as e:
    if "No supported files found" in str(e):
        notify_user_empty_dir(directory)
    else:
        raise

Prevention

When it happens

Trigger: Passing an empty directory, or one containing only unsupported types (.txt, .md), subdirectories, or hidden/unsupported files.

Common situations: Wrong directory passed (e.g. parent of the data folder); conversion step wrote outputs elsewhere; directory contains only intermediate artifacts.

Related errors


AI-assisted analysis of opendatalab/MinerU@4fe4bde114 (2026-08-14). Data as JSON: /api/errors/918a4c6aef7004e3. Report an issue: GitHub.