Sorry, but it doesn't fail for me.
Running current source, I tried:
- Starting calibre.
- Right-click on title's header (for me the first column).
- Choose Add your own columns.
- Pick a composite column. I tested both with and without "behaves like tags".
- Enter "program: virtual_libraries()" into the template in the template editor.
- Press OK
Works fine. No error message.
I then restart calibre. Again, fine, no error message.
What are you doing different from the above?