From 6fea68bff90c527d6cd2092c44fc0e80aaaeec54 Mon Sep 17 00:00:00 2001 From: yangdx Date: Wed, 19 Nov 2025 18:50:45 +0800 Subject: [PATCH] Fix ChunkTokenLimitExceededError message formatting - Prevent passes two separate string objects to __init__ - Maintain same error output --- lightrag/exceptions.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lightrag/exceptions.py b/lightrag/exceptions.py index 64c7ea3e..709f294d 100644 --- a/lightrag/exceptions.py +++ b/lightrag/exceptions.py @@ -118,10 +118,11 @@ class ChunkTokenLimitExceededError(ValueError): preview = chunk_preview.strip() if chunk_preview else None truncated_preview = preview[:80] if preview else None preview_note = f" Preview: '{truncated_preview}'" if truncated_preview else "" - super().__init__( + message = ( f"Chunk token length {chunk_tokens} exceeds chunk_token_size {chunk_token_limit}." f"{preview_note}" ) + super().__init__(message) self.chunk_tokens = chunk_tokens self.chunk_token_limit = chunk_token_limit self.chunk_preview = truncated_preview