(QENG-289) Raise error when template is nil