Encryption - weird results

It's possible it might be intended behaviour - you can try to decrypt it.

If the purpose is to simply suppress the error, add a .default('') formatter before the .encrypt() formatter. However, most likely, there's a logic problem somewhere causing you to try to encrypt a null value. Are you sure the variable you're trying to encrypt exists at the time it runs? If it's a browser request that's sending the value, have you inspected the request to see if the value is being sent?