Error handling for notebooks with invalid format

Fixes #164