It might be that a script is the cause.
Scripts can choose between two different functions to load data, and only one of them works on encrypted archives (both work for unencrypted games).
So if you have a script that uses the wrong function to load data from that file, this script will only work unencrypted and throw that error on encryption.
Only solution: that script needs to be rewritten to use the other function to load its data,