I haven't investigated exactly why this happens, but:
# doas cp /bin/ls /bin/7z
# xbps-pkgdb p7zip
ERROR: p7zip: hash mismatch for /usr/bin/7z.
ERROR: p7zip: files check FAILED.
Failed to check `p7zip': Operation not permitted
The last part of the message seems to be passing a bad value to strerror.