diff --git a/aegisub/src/command/command.h b/aegisub/src/command/command.h
index a67cade0cc76289465c3805c8bac5dd44357dc9a..3fb57bc6077fa4296f9d821b50672e4c217c7afc 100644
--- a/aegisub/src/command/command.h
+++ b/aegisub/src/command/command.h
@@ -28,11 +28,6 @@
 
 namespace agi { struct Context; }
 
-DEFINE_BASE_EXCEPTION_NOINNER(CommandError, agi::Exception)
-DEFINE_SIMPLE_EXCEPTION_NOINNER(CommandNotFound, CommandError, "command/notfound")
-DEFINE_SIMPLE_EXCEPTION_NOINNER(CommandIconNone, CommandError, "command/icon")
-DEFINE_SIMPLE_EXCEPTION_NOINNER(CommandIconInvalid, CommandError, "command/icon/invalid")
-
 #define CMD_NAME(a) const char* name() const { return a; }
 #define STR_MENU(a) wxString StrMenu(const agi::Context *) const { return _(a); }
 #define STR_DISP(a) wxString StrDisplay(const agi::Context *) const { return _(a); }
@@ -50,6 +45,9 @@ struct cname : public Command {                         \
 
 /// Commands
 namespace cmd {
+DEFINE_BASE_EXCEPTION_NOINNER(CommandError, agi::Exception)
+DEFINE_SIMPLE_EXCEPTION_NOINNER(CommandNotFound, CommandError, "command/notfound")
+
 	enum CommandFlags {
 		/// Default command type
 		COMMAND_NORMAL       = 0,
diff --git a/aegisub/src/hotkey.cpp b/aegisub/src/hotkey.cpp
index 8eb36310bd4580c66f4659bb65db74317668f299..bb60674e1061a1ca9b2e27075953346ca508be13 100644
--- a/aegisub/src/hotkey.cpp
+++ b/aegisub/src/hotkey.cpp
@@ -24,6 +24,7 @@
 
 #include "libresrc/libresrc.h"
 #include "command/command.h"
+#include "compat.h"
 #include "options.h"
 
 #include <libaegisub/path.h>
@@ -163,11 +164,18 @@ bool check(std::string const& context, agi::Context *c, int key_code, int modifi
 }
 
 bool check(std::string const& context, agi::Context *c, wxKeyEvent &evt) {
-	if (!hotkey::check(context, c, evt.GetKeyCode(), evt.GetModifiers())) {
-		evt.Skip();
-		return false;
+	try {
+		if (!hotkey::check(context, c, evt.GetKeyCode(), evt.GetModifiers())) {
+			evt.Skip();
+			return false;
+		}
+		return true;
+	}
+	catch (cmd::CommandNotFound const& e) {
+		wxMessageBox(to_wx(e.GetChainedMessage()), _("Invalid command name for hotkey"),
+			wxOK | wxICON_ERROR | wxCENTER | wxSTAY_ON_TOP);
+		return true;
 	}
-	return true;
 }
 
 std::vector<std::string> get_hotkey_strs(std::string const& context, std::string const& command) {
diff --git a/aegisub/src/toolbar.cpp b/aegisub/src/toolbar.cpp
index 0c99623efa1f1de41be4f637002522582f967d0c..7d6311ab7b7c568b1f46b9da720052c621775e91 100644
--- a/aegisub/src/toolbar.cpp
+++ b/aegisub/src/toolbar.cpp
@@ -124,7 +124,7 @@ namespace {
 				try {
 					command = cmd::get(command_name);
 				}
-				catch (CommandNotFound const&) {
+				catch (cmd::CommandNotFound const&) {
 					LOG_W("toolbar/command/not_found") << "Command '" << command_name << "' not found; skipping";
 					continue;
 				}