Can you get WP to throw that same error message...
...by creating a non-wp file renamed with a wp file extension, and opening it in WP using the same open method, as before? Could be a non-descriptive error message that pops when it attempts to open a file not in the right format.
(grasping at straws)
