How do I prevent infinite loops on corrupted files?

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

Image

In my Downloads folder, I am trying to decompress archive files (.zip, .tar, etc) in the Downloads file but keep a copy of the archive file in a subfolder (i.e. ⬇️ Archives). If the archive file happens to be corrupted (e.g. it didn't fully download, it was a bad file to begin with, etc.) an infinite loop happens: the file gets moved to the sub-folder, a copy is made to the parent folder, Hazel tries to unarchive it, but it can't...it detects the copy and then tries to do the process again.

Is there a way to rewrite my rule so that this loop doesn't happen. (Also, why can't hazelworker create a connection to the Notifier?)

Here's a sample of my log output:

Code: Select all
2024-11-07 15:11:02.532 hazelworker[15486] [File Event] File copied: OneDrive_2024-11-07.zip copied from folder /Users/user/Downloads/⬇️ Archives to folder /Users/user/Downloads.
2024-11-07 15:11:02.533 hazelworker[15486] Could not create connection to Notifier
2024-11-07 15:11:02.601 hazelworker[15486] Error unarchiving file: /Users/user/Downloads/OneDrive_2024-11-07.zip
2024-11-07 15:11:02.602 hazelworker[15486] [Error] Unarchive failed: Failed to unpack archive for /Users/user/Downloads/OneDrive_2024-11-07.zip.
2024-11-07 15:11:02.602 hazelworker[15486] Could not create connection to Notifier
2024-11-07 15:11:10.657 hazelworker[15486] OneDrive_2024-11-07.zip: Rule Archives matched.
2024-11-07 15:11:10.659 hazelworker[15486] [File Event] File moved: OneDrive_2024-11-07-1.zip moved from folder /Users/user/Downloads to folder /Users/user/Downloads/⬇️ Archives.
2024-11-07 15:11:10.660 hazelworker[15486] Could not create connection to Notifier
2024-11-07 15:11:10.661 hazelworker[15486] [File Event] File copied: OneDrive_2024-11-07-1.zip copied from folder /Users/user/Downloads/⬇️ Archives to folder /Users/user/Downloads.
2024-11-07 15:11:10.662 hazelworker[15486] Could not create connection to Notifier
2024-11-07 15:11:10.689 hazelworker[15486] Error unarchiving file: /Users/user/Downloads/OneDrive_2024-11-07-1.zip
2024-11-07 15:11:10.689 hazelworker[15486] [Error] Unarchive failed: Failed to unpack archive for /Users/user/Downloads/OneDrive_2024-11-07-1.zip.
2024-11-07 15:11:10.690 hazelworker[15486] Could not create connection to Notifier
2024-11-07 15:11:18.739 hazelworker[15486] OneDrive_2024-11-07-1.zip: Rule Archives matched.
2024-11-07 15:11:18.741 hazelworker[15486] [File Event] File moved: OneDrive_2024-11-07-1-1.zip moved from folder /Users/user/Downloads to folder /Users/user/Downloads/⬇️ Archives.
2024-11-07 15:11:18.741 hazelworker[15486] Could not create connection to Notifier
2024-11-07 15:11:18.744 hazelworker[15486] [File Event] File copied: OneDrive_2024-11-07-1-1.zip copied from folder /Users/user/Downloads/⬇️ Archives to folder /Users/user/Downloads.
2024-11-07 15:11:18.744 hazelworker[15486] Could not create connection to Notifier
2024-11-07 15:11:18.767 hazelworker[15486] Error unarchiving file: /Users/user/Downloads/OneDrive_2024-11-07-1-1.zip
2024-11-07 15:11:18.767 hazelworker[15486] [Error] Unarchive failed: Failed to unpack archive for /Users/user/Downloads/OneDrive_2024-11-07-1-1.zip.
2024-11-07 15:11:18.768 hazelworker[15486] Could not create connection to Notifier
2024-11-07 15:11:26.801 hazelworker[15486] OneDrive_2024-11-07-1-1.zip: Rule Archives matched.
2024-11-07 15:11:26.802 hazelworker[15486] [File Event] File moved: OneDrive_2024-11-07-1-1-1.zip moved from folder /Users/user/Downloads to folder /Users/user/Downloads/⬇️ Archives.
2024-11-07 15:11:26.802 hazelworker[15486] Could not create connection to Notifier
2024-11-07 15:11:26.804 hazelworker[15486] [File Event] File copied: OneDrive_2024-11-07-1-1-1.zip copied from folder /Users/user/Downloads/⬇️ Archives to folder /Users/user/Downloads.
2024-11-07 15:11:26.804 hazelworker[15486] Could not create connection to Notifier
2024-11-07 15:11:26.827 hazelworker[15486] Error unarchiving file: /Users/user/Downloads/OneDrive_2024-11-07-1-1-1.zip
2024-11-07 15:11:26.828 hazelworker[15486] [Error] Unarchive failed: Failed to unpack archive for /Users/user/Downloads/OneDrive_2024-11-07-1-1-1.zip.
pumpkinman
 
Posts: 3
Joined: Sat Nov 02, 2024 10:59 am

As for the notifier, launch Activity Monitor and see if Hazel Notifier is running.

As an alternative, split this up into two rules:

- First rule copies the archive to the folder and does "Continue"
- Second rule unarchives the original file that was left behind.

Note that if there is an error, Hazel will still re-try the rule over time.
Mr_Noodle
Site Admin
 
Posts: 11865
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support