That's quite strange.
The error says that the field "spine_max_index" (= maximum index in the toc) has not been initialized. It should be set when you try to insert the ex libris on a single EPUB file, after getting the spine list. So, if you see the spine list in the window, "spine_max_index" should be set. I am confused.
What are your Calibre version and your OS ?