Oh hahahahahah, you are trying to backup / including this file /etc/spwd.db which you are not allowed to read!
Look, your design is flawed. Look at your pledge call: stdio cpath rpath wpath inet dns exec proc Basically, you want your program to be able to do everything. pledge isn't a wand you wave over software and then it is secure. The subsets of POSIX which remain come with downsides which you MUST consider. You aren't listening to what pledge is telling you -- that if you want security, you should redesign it to operate in a privsep fashion.