I'm not 100% sure if this is the source of the problem, but I think my instructions before were a bit too simplistic...
This script is designed to copy stuff from an old filestore (where the scramble key is unknown) to a new one with a new scramble key.
So for it to work in you situation, you would need to move the relevant portion of your filestore over to a parallel filestore, and then fill in
$source_filestore_path = '/path/to/old/filestore';
at the top of the script, along with the starting ID.
then you would run it, and it would go through the old filestore ID by ID starting whereever you tell it to, move the files into the new filestore, and enter their metadata into the database.
This may be the source of the error you're getting. If not, there could be some other bug. (I do know that this script has worked for me in testing, and has worked for two other people who had lost their scramble keys. So in general I think it is functional.)
Sorry this is a bit complex. The script could definitely be revised to work more cleanly in your specific use case. But I think it could be made to work as is if needed.
-David