You should try to instantiate the `render_template` to the invalid document.