From ecaee43788593ed5f590d30ad93fc29c5f3864db Mon Sep 17 00:00:00 2001 From: yangdx Date: Tue, 16 Sep 2025 13:41:49 +0800 Subject: [PATCH] Add error handling with chunk ID prefixing in entity extraction --- lightrag/operate.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lightrag/operate.py b/lightrag/operate.py index 58278ff5..6293591c 100644 --- a/lightrag/operate.py +++ b/lightrag/operate.py @@ -2179,7 +2179,12 @@ async def extract_entities( async def _process_with_semaphore(chunk): async with semaphore: - return await _process_single_content(chunk) + try: + return await _process_single_content(chunk) + except Exception as e: + chunk_id = chunk[0] # Extract chunk_id from chunk[0] + prefixed_exception = create_prefixed_exception(e, chunk_id) + raise prefixed_exception from e tasks = [] for c in ordered_chunks: