diff --git a/web/pgadmin/tools/sqleditor/static/js/sqleditor.js b/web/pgadmin/tools/sqleditor/static/js/sqleditor.js
index ec8ab954..6ea45b93 100644
--- a/web/pgadmin/tools/sqleditor/static/js/sqleditor.js
+++ b/web/pgadmin/tools/sqleditor/static/js/sqleditor.js
@@ -3736,7 +3736,15 @@ define('tools.querytool', [
                 pgAdmin, self, err, gettext('Download CSV'), [], true
               );
             }
+
+            if (_.isEmpty(msg)) msg = err.statusText || gettext('Download CSV error');
             alertify.alert(gettext('Download CSV error'), msg);
+            // Enable the execute button
+            $('#btn-flash').prop('disabled', false);
+            $('#btn-download').prop('disabled', false);
+            self.disable_tool_buttons(false);
+            self.trigger(
+              'pgadmin-sqleditor:loading-icon:hide');
           });
 
       },
