get_file() function in Moodle can return a boolean or an object. We always assume it finds the file and thus it is an object. When it returns a boolean you get an error which is hard to interpret.
Make sure that when a file is not found, this is reported properly to the end-user, or an appropriate error is thrown in php.
Handle not finding(returning a boolean) file in getContent() of file_storage.php in Moodle.
Timeboxed to 4 hours for delivering good error messages