I'm not sure if this is what you want (for example, I donโt understand if you want to figure out why this is happening and get around it), but if you just want to suppress errors, you can usually use @in in front of the function name.
eg.
$store_filesize = @filesize($file->filepath);
source share