diff --git a/src/backend/langflow/interface/custom/directory_reader.py b/src/backend/langflow/interface/custom/directory_reader.py index b3c8a1883..3357d164f 100644 --- a/src/backend/langflow/interface/custom/directory_reader.py +++ b/src/backend/langflow/interface/custom/directory_reader.py @@ -176,9 +176,14 @@ class DirectoryReader: """ Check if a type hint is used but not imported in the given code. """ - return self._is_type_hint_used_in_args( - type_hint_name, code - ) and not self._is_type_hint_imported(type_hint_name, code) + try: + return self._is_type_hint_used_in_args( + type_hint_name, code + ) and not self._is_type_hint_imported(type_hint_name, code) + except SyntaxError: + # Returns True if there's something wrong with the code + # TODO : Find a better way to handle this + return True def process_file(self, file_path): """