I'm not able to see an issue with the piece of code that you have pasted here. Maybe you could open a bug report with halcust attached and repeatable situation that I can look at?
Hi!
I am not able to run SERP client on Mac (Sonoma), when the folder is outside of Applications.
When and why it happens? I know, that some users with the same system haven't such problem.
...