LightRAG icon indicating copy to clipboard operation
LightRAG copied to clipboard

[Bug]: 'file_path' Error in Mix Mode Retrieval

Open LinuxIsCool opened this issue 8 months ago • 1 comments

Do you need to file an issue?

  • [x] I have searched the existing issues and this bug is not already filed.
  • [x] I believe this is a legitimate bug, not just a question or feature request.

Describe the bug

Issue Description

When using LightRAG's mix mode for queries, the following error consistently appears in logs:

ERROR: Error in get_vector_context: 'file_path'

Despite this error, the mix mode continues to function and returns results successfully. The error appears to be non-critical but may indicate an underlying issue in the vector context retrieval process.

Environment

  • Python version: 3.10
  • OpenAI API version: 1.72.0
  • LightRAG version: 1.3.1 (lightrag-hku)
  • OS: Linux (Pop_OS)

Steps to Reproduce

  1. Initialize LightRAG with OpenAI embeddings and GPT-4o-mini for completions
  2. Add a document using ainsert()
  3. Query using mix mode with aquery() and QueryParam(mode="mix")

Code Sample

import os
import asyncio
from lightrag import LightRAG, QueryParam
from lightrag.llm.openai import gpt_4o_mini_complete, openai_embed
from lightrag.kg.shared_storage import initialize_pipeline_status

async def main():
    # Initialize
    rag = LightRAG(
        working_dir="./resources/lightrag_test",
        embedding_func=openai_embed,
        llm_model_func=gpt_4o_mini_complete
    )
    
    await rag.initialize_storages()
    await initialize_pipeline_status()
    
    # Add document
    doc_id = await rag.ainsert("Your test document content here")
    
    # Query with mix mode
    result = await rag.aquery(
        "What is in this document?",
        param=QueryParam(mode="mix")
    )
    
    # The error occurs during this query but doesn't prevent results
    
if __name__ == "__main__":
    asyncio.run(main())

Debug Information

The error occurs during the retrieval step in mix mode:

INFO: Process XXX buidling query context...
INFO: Query nodes: [...], top_k: 60, cosine: 0.2
INFO: Query edges: [...], top_k: 60, cosine: 0.2
ERROR: Error in get_vector_context: 'file_path'

The error doesn't appear with other modes (naive, local, global, hybrid) - only with mix mode.

Attempted Solutions

I've tried various parameter adjustments with QueryParam, including:

  • Reducing token limits
  • Adjusting top_k values
  • Providing explicit keywords
  • Modifying context parameters

None of these adjustments resolved the issue.

Impact

While the error doesn't seem to prevent getting results from the mix mode, it may:

  • Indicate missing functionality
  • Affect result quality in ways that aren't immediately obvious
  • Create unnecessary log noise

Additional Notes

  • All storage directories and files appear to be properly initialized
  • The mix mode successfully retrieves and combines information despite the error
  • Debug-level logging shows the error occurs during vector context retrieval

Any assistance in resolving this issue would be appreciated. If additional debug information is needed, please let me know.

Steps to reproduce

No response

Expected Behavior

No response

LightRAG Config Used

Paste your config here

Logs and screenshots

No response

Additional Information

LinuxIsCool avatar Apr 12 '25 02:04 LinuxIsCool

Kindly update to the latest version (1.3.1) and perform a complete reindex of all your files.

danielaskdd avatar Apr 12 '25 08:04 danielaskdd