I can reproduce this. (By the way, the ideal place to log API bugs/issues is at our GitHub tracker: https://github.com/SketchUp/api-issue-tracker/issues)
This issue stems from that adding/removing pages (scenes) are not undoable. Those actions are not recorded in the undo manager.
However, since a
Page is an
Entity it exposes the ability to set attributes - which is an undoable operation. This was done a long time ago, way before my time, so I can only guess - but I don’t think the original implementers considered that scenario.
I’ll log this in our issue tracker.
Meanwhile, I don’t see an easy workaround to avoid the crash. You could try to store the attributes on the model instead. And use page name + page id as a way to match the attributes with that pages you want to associate it with. Since the names change you probably want to use the entityID as a backup (though note that it changes between sessions.)