I got this error when testing my changes on the copy_cover_to_device plugin, where I just overlooked something.
Normally that shouldn't be possible as plugins should be tested that way, just wanted to report it anyway.
You can easily produce this error.
Leave out a : at an if-clause and add the plugin. Correct the error, import it again. The first time it was imported even though there was the error, afterwards you got the error message above.