This internal error message is generated if QuarkXPress, while iterating through all the objects of a file being scanned (or being used as part of diary generation, the title of the message will tell you which of these 2 cases applies), encounters an object whose layer cannot be identified. This is an impossibility as all objects must belong to a layer.
This message is thus an indication that your QuarkXPress document is most likely corrupted. You should try to copy it into a fresh file and try again.
If the problem remains, please send the script to technical support, being sure to mention the error message ID listed at the bottom of this topic.