I am very surprised that you use the same vocabulary in both contexts: a SimpleVocabulary
has by definition a fixed number of terms; a "Query Source" is quite different.
When I must analyze difficult situations involving exceptions, I use Products.PDBDebugMode
. (If Plone runs in "debug mode",) it enters the Python debugger in the context of the exception and I can (quite easily) analyze what goes wrong and where the problematic values comes from.