From 9358bec393a2b5a36a55b48b1c0e11cab15616a3 Mon Sep 17 00:00:00 2001 From: Matthew Zhou Date: Sun, 24 Aug 2025 17:28:11 -0700 Subject: [PATCH] fix: Remove possibility of empty strings when updating (#4149) --- letta/services/agent_serialization_manager.py | 5 ++++- letta/services/file_processor/file_processor.py | 7 +++++-- letta/utils.py | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/letta/services/agent_serialization_manager.py b/letta/services/agent_serialization_manager.py index 55b50907..5635ed3b 100644 --- a/letta/services/agent_serialization_manager.py +++ b/letta/services/agent_serialization_manager.py @@ -936,7 +936,10 @@ class AgentSerializationManager: # update file status to ERROR try: await self.file_manager.update_file_status( - file_id=file_id, actor=actor, processing_status=FileProcessingStatus.ERROR, error_message=str(e) + file_id=file_id, + actor=actor, + processing_status=FileProcessingStatus.ERROR, + error_message=str(e) if str(e) else f"Agent serialization failed: {type(e).__name__}", ) except Exception as update_error: logger.error(f"Failed to update file status to ERROR for {file_id}: {update_error}") diff --git a/letta/services/file_processor/file_processor.py b/letta/services/file_processor/file_processor.py index 76cac3d7..6e63a1ec 100644 --- a/letta/services/file_processor/file_processor.py +++ b/letta/services/file_processor/file_processor.py @@ -264,7 +264,10 @@ class FileProcessor: }, ) await self.file_manager.update_file_status( - file_id=file_metadata.id, actor=self.actor, processing_status=FileProcessingStatus.ERROR, error_message=str(e) + file_id=file_metadata.id, + actor=self.actor, + processing_status=FileProcessingStatus.ERROR, + error_message=str(e) if str(e) else f"File processing failed: {type(e).__name__}", ) return [] @@ -361,7 +364,7 @@ class FileProcessor: file_id=file_metadata.id, actor=self.actor, processing_status=FileProcessingStatus.ERROR, - error_message=str(e), + error_message=str(e) if str(e) else f"Import file processing failed: {type(e).__name__}", ) return [] diff --git a/letta/utils.py b/letta/utils.py index 7ca81bff..b3983eab 100644 --- a/letta/utils.py +++ b/letta/utils.py @@ -1132,7 +1132,7 @@ def safe_create_file_processing_task(coro, file_metadata, server, actor, logger: file_id=file_metadata.id, actor=actor, processing_status=FileProcessingStatus.ERROR, - error_message=f"Processing failed: {str(e)}" if str(e) else "Processing failed due to an unexpected error", + error_message=f"Processing failed: {str(e)}" if str(e) else f"Processing failed: {type(e).__name__}", ) except Exception as update_error: logger.error(f"Failed to update file status to ERROR for {file_metadata.id}: {update_error}")