@app.errorhandler(404) async def page_not_found(e): return render_template("404.html"), 404 The handler is executed 3 times even if render_template throws an exception and returns 500 On the client, a log was written when the last handler was executed. Continue reading...