The error message indicates that the file was expected to be a valid TIFF file, but the magic number in the file did not match that of the TIFF format.
It appears that you are using a third party function. Your best bet is to debug the code to figure out why a bad tiff is being passed in. You could also consider contacting the author of the code/data source.