diff --git a/docs/changes.txt b/docs/changes.txt
index 8ee60fc3f..83ca2ee94 100644
--- a/docs/changes.txt
+++ b/docs/changes.txt
@@ -1,3 +1,11 @@
+* changes v3.40 -> ?:
+
+##
+## Bugs
+##
+
+- Fixed a problem where --keyspace combined with custom charsets incorrectly displayed an error message
+
 * changes v3.30 -> v3.40:
 
 ##
diff --git a/src/user_options.c b/src/user_options.c
index 3949d9664..e08ee37ba 100644
--- a/src/user_options.c
+++ b/src/user_options.c
@@ -820,9 +820,12 @@ int user_options_sanity (hashcat_ctx_t *hashcat_ctx)
 
     if (user_options->hc_argc < 2)
     {
-      event_log_error (hashcat_ctx, "You need to specify a mask if you specify a custom-charset");
+      if (user_options->keyspace == false) // --keyspace would be a special case, i.e. we do not need a hash file
+      {
+        event_log_error (hashcat_ctx, "You need to specify a mask if you specify a custom-charset");
 
-      return -1;
+        return -1;
+      }
     }
   }