[Solved] Socket errors only when running via Systemd

I am getting errors with Restic (0.19.0 compiled with go1.26.4) backups that have been scheduled via Systemd, but do not get the same errors when running the same scripts manually. This makes me believe there is some permission I’m missing.

The relevant Restic files, including a log of one successful and one unsuccessful run of Restic, can be found in this public Git repo.

The error I am getting is around sockets being created and can be seen in greater detail in the restic.log file in the above Git repo:

Stat(<config/>) returned error, retrying after 915.118336ms: Stat: Get "https://s3.us-west-000.backblazeb2.com/s-/?location=": dial tcp [2605:72c0:5ff:b3::b000:1]:443: socket: address family not supported by protocol

IPv6 works fine on my system and network, so I’m guessing this is a permission that is being restricted by systemd. Does anyone see what I’ve missed?

Ok, I have always hated when you finally ask a question and immediately solve your own problem. My issue was caused by line 30 of the restic-backup.service
RestrictAddressFamilies=AF_UNIX # AF_INET AF_INET6 (for remote storage)

That # being in the middle of the line meant I didn’t see it! Moving it to only comment out the (for remote storage) portion of the line seems to have fixed the errors. Maybe this will help someone in the future.

I guess, since I’m here already, does anyone see anything I should do to improve my Restic setup?