Insert error server in middleware