As I said, I can't make it fail, either when using the template tester on a book or when defining a composite column. (Note: when defining a new column you can right-click on the template box to open a template editor.)
I wonder if it has something to do with a plugin. Could you zip your calibre config folder and send it to me so I can run a test with the same plugins and settings that you have? I know that Action Chains does things with template functions. Do you have any chains that run at startup? You could try running calibre with
Code:
calibre --ignore-plugins
to see if the behavior changes.
Another test would be for you to open the library with a clean (empty) configuration folder. What I did was copy the config folder somewhere then emptied the original. When I started calibre I got the startup wizard, where I picked the library containing your metadata.db. This process removes all plugins and all settings.
If you can run from source then we might learn something from adding a debugging print to the template tester. The two lines of code are:
Code:
print(f'Using standard builtin and custom functions: {all_functions is None}')
traceback.print_stack()
In current source and almost certainly source for 7.2 they go at line 411, as shown here.