Skip to content

[Bug]: regress parsing result from minerU #12080

Closed

Description

@adagora

Self Checks

  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (Language Policy).
  • Non-english title submitions will be closed directly ( 非英文标题的提交将会被直接关闭 ) (Language Policy).
  • Please do not modify this template :) and fill in all the required fields.

RAGFlow workspace code commit ID

31f4e6f70a98f54734d68b18971fc7ca2f6d1e38

RAGFlow image version

main

Other environment information

Actual behavior

I'm using the latest main, I've currently launched minerU and connected it to the ragflow UI,
pipeline backend (the rest of the backend options don't work for me because they return TypeError: 'NoneType' object is not iterable, log below).
Why do we get a lot of chaos after parsing using this pipeline backend, and a completely different PDF cut (less granularity) than through minerU-gradio (UI)?
thanks for the explanation, I appreciate your work

Image

screen from gradio:
Image

this is my docker-compose if you want to launch mineru:

docker-compose-mineru.yml

version: '3.8'

services:
  # MinerU with integrated vLLM - Latest unified image
  # This image includes both MinerU and vLLM server
  mineru-server:
    image: mineru:latest
    container_name: mineru-server
    profiles:
      - mineru-gpu
    environment:
      # GPU device selection (change to "0,1" for multi-GPU)
      - CUDA_VISIBLE_DEVICES=0
      # Hugging Face mirror for faster model downloads
      - HF_ENDPOINT=${HF_ENDPOINT:-https://hf-mirror.com/}
      # Complex PDF processing optimizations
      - MINERU_PDF_RENDER_TIMEOUT=600
      - MINERU_TABLE_MERGE_ENABLE=true
      - MINERU_FORMULA_CH_SUPPORT=true
      # vLLM engine settings
      - VLLM_GPU_MEMORY_UTILIZATION=0.85
      - VLLM_MAX_MODEL_LEN=32768
    command: "mineru-api --host 0.0.0.0 --port 30000"
    ports:
      - "30000:30000"  # MinerU API
      - "8000:8000"    # vLLM OpenAI-compatible API (if exposed)
    volumes:
      - mineru-output:/app/output
      - mineru-models:/root/.cache/huggingface
      - mineru-data:/app/data
    shm_size: 32g
    ipc: host
    ulimits:
      memlock: -1
      stack: 67108864
    networks:
      - ragflow
    restart: always
    deploy:
      resources:
        reservations:
          devices:
            - driver: nvidia
              # Use device_ids: ['0'] for specific GPU or count: all for all GPUs
              device_ids: ['0']
              capabilities: [gpu]
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:30000/openapi.json"]
      interval: 30s
      timeout: 10s
      retries: 5
      start_period: 300s  # Allow time for model download and loading

  # MinerU Gradio WebUI (Optional - for testing and debugging)
  mineru-gradio:
    image: mineru:latest
    container_name: mineru-gradio
    profiles:
      - mineru-gradio
    depends_on:
      mineru-server:
        condition: service_healthy
    environment:
      - MINERU_API_URL=http://mineru-server:30000/
      - HF_ENDPOINT=${HF_ENDPOINT:-https://hf-mirror.com/}
    command: "mineru-gradio --server-name 0.0.0.0 --server-port 7860 --enable-vllm-engine true"
    ports:
      - "7860:7860"
    networks:
      - ragflow
    restart: always

volumes:
  mineru-output:
    driver: local
  mineru-models:
    driver: local
  mineru-data:
    driver: local

networks:
  ragflow:
    external: true

Dockerfile.mineru

# Use the official vllm image for gpu with Ampere architecture and above (Compute Capability>=8.0)
# Compute Capability version query (https://developer.nvidia.com/cuda-gpus)
FROM vllm/vllm-openai:v0.10.1.1

# Use the official vllm image for gpu with Turing architecture and below (Compute Capability<8.0)
# FROM vllm/vllm-openai:v0.10.2

# Install libgl for opencv support & Noto fonts for Chinese characters
RUN apt-get update && \
    apt-get install -y \
        fonts-noto-core \
        fonts-noto-cjk \
        fontconfig \
        libgl1 && \
    fc-cache -fv && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/*

# Install mineru latest
RUN python3 -m pip install -U 'mineru[core]' --break-system-packages && \
    python3 -m pip cache purge

# Download models and update the configuration file
RUN /bin/bash -c "mineru-models-download -s huggingface -m all"

# Set the entry point to activate the virtual environment and run the command line tool
ENTRYPOINT ["/bin/bash", "-c", "export MINERU_MODEL_SOURCE=local && exec \"$@\"", "--"]

mineru-startup.sh

#!/bin/bash
# MinerU GPU Server Startup Script

set -e
COMPOSE_FILE="docker-compose-mineru.yml"

case "${1:-help}" in
    start)
        docker compose -f "$COMPOSE_FILE" --profile mineru-gpu up -d
        echo "MinerU started. Logs: docker logs -f mineru-server"
        ;;
    start-ui)
        docker compose -f "$COMPOSE_FILE" --profile mineru-gpu --profile mineru-gradio up -d
        echo "MinerU + UI started"
        echo "API: http://localhost:30000/"
        echo "UI: http://localhost:7860/"
        ;;
    stop)
        docker compose -f "$COMPOSE_FILE" --profile mineru-gpu --profile mineru-gradio down
        ;;
    restart)
        docker compose -f "$COMPOSE_FILE" --profile mineru-gpu restart
        ;;
    logs)
        docker compose -f "$COMPOSE_FILE" logs -f "${@:2}"
        ;;
    status)
        docker compose -f "$COMPOSE_FILE" ps
        echo ""
        curl -f http://localhost:30000/openapi.json &> /dev/null && \
            echo "✓ API is running" || echo "✗ API not responding"
        ;;
    *)
        echo "Usage: $0 {start|start-ui|stop|restart|logs|status}"
        echo ""
        echo "  start      - Start MinerU server"
        echo "  start-ui   - Start MinerU server + Web UI"
        echo "  stop       - Stop MinerU"
        echo "  restart    - Restart MinerU"
        echo "  logs       - View logs"
        echo "  status     - Check status"
        ;;
esac

TypeError: 'NoneType' object is not iterable

await do_handle_task(task) File "/ragflow/common/connection_utils.py", line 74, in async_wrapper return await func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/ragflow/rag/svr/task_executor.py", line 1004, in do_handle_task chunks = await build_chunks(task, progress_callback) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/ragflow/common/connection_utils.py", line 74, in async_wrapper return await func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/ragflow/rag/svr/task_executor.py", line 252, in build_chunks cks = await asyncio.to_thread( ^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.12/asyncio/threads.py", line 25, in to_thread return await loop.run_in_executor(None, func_call) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.12/asyncio/futures.py", line 287, in __await__ yield self # This tells Task to wait for completion. ^^^^^^^^^^ File "/usr/lib/python3.12/asyncio/tasks.py", line 385, in __wakeup future.result() File "/usr/lib/python3.12/asyncio/futures.py", line 203, in result raise self._exception.with_traceback(self._exception_tb) File "/usr/lib/python3.12/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/ragflow/rag/app/manual.py", line 248, in chunk sections = [_normalize_section(sec) for sec in sections] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: 'NoneType' object is not iterable [2025-12-19 14:29:20 +0100] [19] [INFO] 127.0.0.1:60452 GET /v1/kb/detail 1.1 200 1320 1008895 [2025-12-19 14:29:24 +0100] [19] [INFO] 127.0.0.1:60466 POST /v1/document/list 1.1 200 30183 7521 [2025-12-19 14:29:24 +0100] [19] [INFO] 127.0.0.1:60476 GET /v1/kb/detail 1.1 200 1320 8031 2025-12-19 14:29:30,051 INFO 35 task_executor_1cfae6aae9d7_0 reported heartbeat: {"ip_address": "172.18.0.8", "pid": 35, "name": "task_executor_1cfae6aae9d7_0", "now": "2025-12-19T14:29:30.051+01:00", "boot_at": "2025-12-19T13:55:28.929+01:00", "pending": 0, "lag": 0, "done": 2, "failed": 1, "current": {}} 2025-12-19 14:30:00,056 INFO 35 task_executor_1cfae6aae9d7_0 reported heartbeat: {"ip_address": "172.18.0.8", "pid": 35, "name": "task_executor_1cfae6aae9d7_0", "now": "2025-12-19T14:30:00.054+01:00", "boot_at": "2025-12-19T13:55:28.929+01:00", "pending": 0, "lag": 0, "done": 2, "failed": 1, "current": {}}

Expected behavior

No response

Steps to reproduce

1. model provider MinerU (local docker app)
2. pdf parser this minerU added, pipeline backend

Additional information

No response

Activity

  1. added
    🐞 bugSomething isn't working, pull request that fix bug.
    on Dec 22, 2025
  2. dosubot commented on Dec 22, 2025

    @dosubot

    The "TypeError: 'NoneType' object is not iterable" happens when the MinerU parser fails (often due to misconfiguration or API issues) and returns None, but the pipeline backend tries to process it as if it were a list of sections. This is a known gap in error handling: if MinerU can't parse or connect, the error surfaces as a crash instead of a clear message. This can also explain why you see "chaotic" or less granular parsing—if MinerU returns empty or malformed output, the chunking logic can't recover and produces poor results or nothing at all. The UI (MinerU-gradio) may use different defaults or connect to MinerU differently, so it can succeed where the pipeline backend fails or produces different chunking granularity.

    Recent code changes refactored how MinerU config is parsed and how environment variables like MINERU_APISERVER, MINERU_BACKEND, and MINERU_SERVER_URL are resolved. If these aren't set correctly, or if the backend type doesn't match your MinerU deployment, the pipeline backend may not be able to reach MinerU or may call it with the wrong parameters, leading to None returns and the error you see. The chunk_token_num is also set to 0 for 'mineru', which can affect chunking granularity and lead to different results than the UI, which may use a different chunk size or parsing method by default (source, source, source).

    To improve consistency and avoid the error, double-check that your pipeline backend and MinerU-gradio UI use the same MinerU API endpoint, backend type, and parser settings. Make sure MINERU_APISERVER and MINERU_BACKEND are set and reachable from the RAGFlow backend. If you still see the error, adding a guard in the code to check for None before iterating over sections would prevent the crash and surface a clearer error message.

    Finally, MinerU integration is marked as experimental, so some inconsistencies between UI and backend are expected until the integration matures (source).

    To reply, just mention @dosu.


    How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other

    Chat with Dosu Open in Cursor Join Discord Share on X

  3. yongtenglei commented on Dec 22, 2025

    @yongtenglei
    Member

    Hi, @adagora

    Please test the latest codebase. RAGFlow currently only retrieves and parses the content_list.json file from MinerU. Let me know the parsing result from the latest code. All backends are expected fully operational.

  4. adagora commented on Dec 22, 2025

    @adagora
    ContributorAuthor

    @yonghuili1
    backend works, same messy parsing result, deepdoc seems works better in this pdf more granurality
    Build in: Manual

    logs:

    09:53:11 Task has been received.
    09:53:14 Page(1~41): Start to parse.
    09:53:14 Page(1~41): [MinerU] Received binary PDF -> /tmp/mineru_bin_pdf_dpgvmzd6/KT_Develo_Okna_PVC_04-2025_PL_update[1].pdf
    09:53:14 Page(1~41): [MinerU] Output directory: /tmp/mineru_pdf_wh1h5yhi
    09:53:15 Page(1~41): [MinerU] invoke api: http://host.docker.internal:30000/file_parse
    10:05:37 Page(1~41): [MinerU] zip file returned, saving to /tmp/mineru_pdf_wh1h5yhi/KT_Develo_Okna_PVC_04-2025_PL_update[1]_auto_3b8sahp4.zip...
    10:05:37 Page(1~41): [MinerU] Unzip to /tmp/mineru_pdf_wh1h5yhi/KT_Develo_Okna_PVC_04-2025_PL_update[1]_auto_3b8sahp4...
    10:05:38 Page(1~41): [MinerU] Parsed 737 blocks from PDF.
    10:05:38 Page(1~41): Finish parsing.
    10:05:38 Page(1~41): Generate 41 chunks
    10:05:44 Page(1~41): Embedding chunks (5.92s)
    10:05:45 Page(1~41): Indexing done (0.86s).
    10:05:45 Page(1~41): Task done (754.14s)
    
    Image

    deepdoc result:

    Image

    TypeError: 'NoneType' object is not iterable
    This may be due to the graphics card. I have a new NVIDIA model, which may not be supported.

  5. yongtenglei commented on Dec 23, 2025

    @yongtenglei
    Member

    Hi, @adagora

    Please use General rather than Manual, you should get the same results from minerU-gradio, I guess. Let me know if it solves the odd parsing result.

  6. adagora commented on Dec 23, 2025

    @adagora
    ContributorAuthor

    Hi @yongtenglei
    General - a lot better, faster parsing
    still not all images are attached
    for example, this section with the color pallets is missing
    also MinerU Options I am not sure if they only apply to the backend pipeline, vlm-vllm-async-engine is supported?

    Image Image Image Image Image
  7. yongtenglei commented on Dec 24, 2025

    @yongtenglei
    Member

    Hi, @adagora

    still not all images are attached
    for example, this section with the color pallets is missing

    RAGFlow simply parse the result from MinerU. If MinerU cannot recognize this section well, this would be the expected behavior I guess :(

    also MinerU Options I am not sure if they only apply to the backend pipeline, vlm-vllm-async-engine is supported?

    vlm-vllm-async-engine is theoretically supported.

    pipeline, vlm-http-client, vlm-transformers, vlm-vllm-engine vlm-mlx-engine are offically tested.

    texts without reference

    Since these texts are "mis-recognized" and too short (less than 8 tokens, kind of), thus, these texts are simply treat as chunks without extra processing.

    I hope this would be helpful.

  8. adagora commented on Dec 24, 2025

    @adagora
    ContributorAuthor

    @yongtenglei Ok, but mineru recognizes these sections, i.e. there is a bounding box around all the images above from the screenshots, maybe it's a problematic pdf I came across

  9. adagora commented on Jan 8, 2026

    @adagora
    ContributorAuthor

    @yongtenglei I tried all this methods

    for example:
    SAFETY PIN (~4 tokens) there is also text next to this header (more than 8 for sure) but there is no image from the pdf
    is it better to customize this limit by user?
    looks like incomplete on on all the methods you mentioned

    Image

    sometimes ive seen in mineru api service logs:

    Predict:  98%|█████████▊| 781/793 [03:11<00:06,  1.79it/s]
    
    Predict: 100%|█████████▉| 790/793 [03:15<00:01,  1.94it/s]
    
    Predict: 100%|██████████| 793/793 [03:19<00:00,  1.55it/s]
    
    Predict: 100%|██████████| 793/793 [03:19<00:00,  3.97it/s]
    
    
    Post Processing:   0%|          | 0/40 [00:00<?, ?it/s]
    
    Post Processing: 100%|██████████| 40/40 [00:00<00:00, 4881.64it/s]
    
    2026-01-08 01:55:38.765 | INFO     | mineru.cli.common:_process_output:168 - local output dir is ./output/d5c01ebc-350a-4ac5-b57a-072d96e433a2/KT_Develo_Okna_PVC_04-2025_PL_update_test/vlm
    
    INFO:     172.21.0.1:49186 - "POST /file_parse HTTP/1.1" 200 OK
    
    INFO:     172.21.0.1:44634 - "HEAD /openapi.json HTTP/1.1" 200 OK
    
    2026-01-08 02:38:00.835 | WARNING  | mineru.utils.pdf_page_id:get_end_page_id:8 - end_page_id is out of range, use images length
  10. adagora commented on Jan 21, 2026

    @adagora
    ContributorAuthor

    @yingfeng there is positons but no image fyi

    Image
  11. changed the title [-][Bug]: odd parsing result using minerU[/-] [+][Bug]: regress parsing result from minerU[/+] on Jan 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

🐞 bugSomething isn't working, pull request that fix bug.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions