[Question]: TypeError: DocProcessingStatus.__init__() got an unexpected keyword argument 'multimodal_processed'

Author: alameen1999Created Aug 2, 2025Updated Aug 12, 2026
Labelsquestion

Do you need to ask a question?

  • I have searched the existing question and discussions and this question is not already answered.
  • I believe this is a legitimate question, not just a bug or feature request.

Your Question

I'm encountering a TypeError when attempting to insert documents using RAGAnything.insert_content_list(). The error originates deep within the lightrag library, specifically when the system tries to load the document processing status. It seems the DocProcessingStatus data model is out of sync with the data being written to the status store, as it doesn't recognize the multimodal_processed field.

This issue occurs when I try to upload multiple file path.

Additional Context

To Reproduce Steps to reproduce the behavior:

Set up a RAGAnything instance, connecting it to a LightRAG backend.

Use a custom document parser (like the PyMuPDF example below) to create a content_list.

Call the rag.insert_content_list() method to ingest the parsed content.

The pipeline fails with the traceback shown below.

Traceback (most recent call last):
  File "/home/alameenn/RAG-Anything/main.py", line 76, in process_file
    await rag.insert_content_list(
  File "/home/alameenn/RAG-Anything/raganything/processor.py", line 1439, in insert_content_list
    await insert_text_content(
  File "/home/alameenn/RAG-Anything/raganything/utils.py", line 81, in insert_text_content
    await lightrag.ainsert(
  File "/home/alameenn/RAG-Anything/.venv/lib/python3.11/site-packages/lightrag/lightrag.py", line 730, in ainsert
    await self.apipeline_process_enqueue_documents(
  File "/home/alameenn/RAG-Anything/.venv/lib/python3.11/site-packages/lightrag/lightrag.py", line 1370, in apipeline_process_enqueue_documents
    processing_docs, failed_docs, pending_docs = await asyncio.gather(
                                                 ^^^^^^^^^^^^^^^^^^^^^
  File "/home/alameenn/RAG-Anything/.venv/lib/python3.11/site-packages/lightrag/kg/json_doc_status_impl.py", line 108, in get_docs_by_status
    result[k] = DocProcessingStatus(**data)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: DocProcessingStatus.__init__() got an unexpected keyword argument 'multimodal_processed'

sample code:

import os
import asyncio
import fitz  # PyMuPDF
from lightrag import LightRAG, RAGAnything, RAGAnythingConfig
from lightrag.kg.shared_storage import initialize_pipeline_status
from lightrag.llm.openai import openai_complete_if_cache, openai_embed
from lightrag.utils import EmbeddingFunc, logger
from dotenv import load_dotenv

load_dotenv()

def parse_document_with_pymupdf(file_path: str) -> list:
    """A sample parser that extracts text from a PDF."""
    content_list = []
    try:
        doc = fitz.open(file_path)
        for page_num, page in enumerate(doc):
            text = page.get_text()
            if text.strip():
                content_list.append({
                    "type": "text",
                    "text": text,
                    "page_idx": page_num,
                })
        doc.close()
        logger.info(f"PyMuPDF parsing complete. Found {len(content_list)} content elements.")
        return content_list
    except Exception as e:
        logger.error(f"Failed to parse PDF with PyMuPDF: {e}")
        return []

async def main():
    """Main function to run the example"""
    api_key = os.getenv("OPENAI_API_KEY") # Ensure this is set in your .env
    if not api_key:
        raise ValueError("OPENAI_API_KEY must be set in the environment.")

    # 1. Initialize LightRAG
    lightrag_instance = LightRAG(
        working_dir='./rag_storage',
        llm_model_func=lambda prompt, **kwargs: openai_complete_if_cache("gpt-4o-mini", prompt, api_key=api_key, **kwargs),
        embedding_func=EmbeddingFunc(
            embedding_dim=3072,
            func=lambda texts: openai_embed(texts, model="text-embedding-3-large", api_key=api_key),
        )
    )
    await lightrag_instance.initialize_storages()
    await initialize_pipeline_status()

    # 2. Define a vision model function (required by RAGAnything)
    def vision_model_func(prompt, image_data, **kwargs):
        # Dummy function for this example
        return "Vision model not implemented for this test."

    # 3. Configure and initialize RAGAnything
    config = RAGAnythingConfig(enable_image_processing=True)
    rag = RAGAnything(
        config=config,
        lightrag=lightrag_instance,
        vision_model_func=vision_model_func,
    )

    # 4. Parse a document and attempt to insert it
    file_path = "/path/to/your/document.pdf"  # <--- CHANGE THIS TO A VALID PDF PATH
    if not os.path.exists(file_path):
        logger.error(f"File not found: {file_path}. Please create a dummy PDF or use a real one.")
        return
        
    content_list = parse_document_with_pymupdf(file_path)

    logger.info("Inserting content list into RAGAnything...")
    await rag.insert_content_list(
        content_list=content_list,
        file_path=os.path.basename(file_path),
        doc_id="demo-doc-001",
    )
    logger.info("Content list insertion completed!")

if __name__ == "__main__":
    asyncio.run(main())