open-webui/open-webui · warning · HTTPException

MinerU returned empty results

Error message

MinerU returned empty results

What it means

Raised as HTTP 400 when the Local API returns a 'results' object that is empty ({}). The service completed with 200 but produced zero per-file entries - i.e. the uploaded file produced no parse result at all, usually because the multipart filename key did not match or parsing silently yielded nothing.

Source

Thrown at backend/open_webui/retrieval/loaders/mineru.py:151

        # Parse response
        try:
            result = response.json()
        except ValueError as e:
            raise HTTPException(
                status.HTTP_502_BAD_GATEWAY,
                detail=f'Invalid JSON response from MinerU Local API: {e}',
            )

        # Extract markdown content from response
        if 'results' not in result:
            raise HTTPException(
                status.HTTP_502_BAD_GATEWAY,
                detail="MinerU Local API response missing 'results' field",
            )

        results = result['results']
        if not results:
            raise HTTPException(
                status.HTTP_400_BAD_REQUEST,
                detail='MinerU returned empty results',
            )

        # Get the first (and typically only) result
        file_result = list(results.values())[0]
        markdown_content = file_result.get('md_content', '')

        if not markdown_content:
            raise HTTPException(
                status.HTTP_400_BAD_REQUEST,
                detail='MinerU returned empty markdown content',
            )

        log.info(f'Successfully parsed document with MinerU Local API: {filename}')

        # Create metadata
        metadata = {

View on GitHub (pinned to 01f4282f1f)

Solutions

  1. Check the file is non-empty and a supported type (PDF/Office/images) before parsing
  2. Reproduce with curl -F 'files=@doc.pdf' and inspect the results map
  3. Check MinerU server logs for skipped/failed file registration
  4. Re-save or re-export a possibly corrupt source document and retry

Example fix

// before
loader = MinerULoader(file_path=p, api_mode='local')

// after
import os
if os.path.getsize(p) == 0:
    raise ValueError(f'{p} is empty')
loader = MinerULoader(file_path=p, api_mode='local')
Defensive patterns

Strategy: validation

Validate before calling

import os
assert os.path.exists(path) and os.path.getsize(path) > 0, 'empty or missing file'
assert os.path.splitext(path)[1].lower() in {'.pdf', '.docx', '.pptx', '.png', '.jpg'}, 'unsupported type'

Try / catch

try:
    docs = loader.load()
except HTTPException as e:
    if e.status_code == 400 and 'empty results' in e.detail:
        log.warning('MinerU produced no result entries for %s', path)
    raise

Prevention

When it happens

Trigger: The 'files' multipart part name/filename mismatch so MinerU indexes nothing under that name; a corrupt or zero-byte uploaded file that MinerU skips; server-side filtering (e.g. unsupported extension) returning an empty map.

Common situations: Zero-byte or truncated file at file_path (interrupted upload to the server); a file type the MinerU build does not register; disk issues making the read return nothing.

Related errors


AI-assisted analysis of open-webui/open-webui@01f4282f1f (2026-08-14). Data as JSON: /api/errors/212a3e68c23823c4. Report an issue: GitHub.