diff --git a/fc-solve/source/cmd_line.c b/fc-solve/source/cmd_line.c
index 2026cd101..ee6a542d2 100644
--- a/fc-solve/source/cmd_line.c
+++ b/fc-solve/source/cmd_line.c
@@ -699,11 +699,16 @@ DLLEXPORT int freecell_solver_user_cmd_line_parse_args_with_file_nesting_count(
                                     : (file_nesting_count - 1)),
                             opened_files_dir);
 
-                    if (!((ret == FCS_CMD_LINE_UNRECOGNIZED_OPTION) ||
-                            (ret == FCS_CMD_LINE_OK)))
+                    if (ret != FCS_CMD_LINE_OK)
                     {
+                        if (freecell_solver_user_get_unrecognized_cmd_line_flag_status(
+                                instance, 0) == 1)
+                        {
+                            freecell_solver_user_set_unrecognized_cmd_line_flag(
+                                instance, 0, args_man.argv[*last_arg]);
+                        }
                         /* So we don't give a last_arg to the read file.*/
-                        *last_arg = (int)(arg - &(argv[0]));
+                        *last_arg = (int)(arg - 1 - &(argv[0]));
                         fc_solve_args_man_free(&args_man);
                         return ret;
                     }
diff --git a/fc-solve/source/handle_parsing.h b/fc-solve/source/handle_parsing.h
index d7872dbe2..09a1ada2d 100644
--- a/fc-solve/source/handle_parsing.h
+++ b/fc-solve/source/handle_parsing.h
@@ -48,9 +48,25 @@ static inline void *alloc_instance_and_parse(const int argc GCC_UNUSED,
         exit(0);
 
     case FCS_CMD_LINE_UNRECOGNIZED_OPTION:
-        if (only_recognized)
+        if (only_recognized || ((*arg_ptr) < argc - 1))
         {
-            exit_error("Unknown option: %s\n", argv[*arg_ptr]);
+            char *opt = NULL;
+            char opt_static[1000];
+            const_AUTO(status,
+                freecell_solver_user_get_unrecognized_cmd_line_flag_status(
+                    instance, 0));
+
+            if (status == 0)
+            {
+                opt = freecell_solver_user_get_unrecognized_cmd_line_flag(
+                    instance, 0);
+                strncpy(opt_static, opt, COUNT(opt_static) - 1);
+                LAST(opt_static) = '\0';
+                free(opt);
+            }
+            exit_error("Unknown option \"%s\". Type \"%s --help\" for usage "
+                       "information.\n",
+                (status == 0 ? opt_static : argv[*arg_ptr]), argv[0]);
         }
         break;
     case FCS_CMD_LINE_PARAM_WITH_NO_ARG:
diff --git a/fc-solve/source/include/freecell-solver/fcs_user.h b/fc-solve/source/include/freecell-solver/fcs_user.h
index d3f9120f7..4343c2e64 100644
--- a/fc-solve/source/include/freecell-solver/fcs_user.h
+++ b/fc-solve/source/include/freecell-solver/fcs_user.h
@@ -366,6 +366,14 @@ typedef struct
 DLLEXPORT extern void fc_solve_user_set_ht_compiled_prelude(
     void *, size_t, const fc_solve_prelude_item *);
 
+int DLLEXPORT freecell_solver_user_set_unrecognized_cmd_line_flag(
+    void *const api_instance, const int flag_idx, const char *val);
+
+DLLEXPORT char *freecell_solver_user_get_unrecognized_cmd_line_flag(
+    void *, int);
+
+DLLEXPORT int freecell_solver_user_get_unrecognized_cmd_line_flag_status(
+    void *const api_instance, const int flag_idx);
 #ifdef __cplusplus
 }
 #endif
diff --git a/fc-solve/source/lib.c b/fc-solve/source/lib.c
index 64629f608..859a9acb1 100644
--- a/fc-solve/source/lib.c
+++ b/fc-solve/source/lib.c
@@ -2073,6 +2073,9 @@ typedef struct
     FCS_ON_NOT_FC_ONLY(fcs_preset common_preset;)
     FCS__DECL_ERR_BUF(error_string)
     meta_allocator meta_alloc;
+#ifndef FCS_USE_PRECOMPILED_CMD_LINE_THEME
+    char *unrecognized_cmd_line_options[1];
+#endif
 } fcs_user;
 
 static inline fcs_instance *user_obj(fcs_user *const user)
@@ -2403,6 +2406,12 @@ static MYINLINE void user_initialize(fcs_user *const user)
     user->flares_choice = FLARES_CHOICE_FC_SOLVE_SOLUTION_LEN;
 #endif
     user->flares_iters_factor = 1.0;
+#endif
+#ifndef FCS_USE_PRECOMPILED_CMD_LINE_THEME
+    for (size_t i = 0; i < COUNT(user->unrecognized_cmd_line_options); ++i)
+    {
+        user->unrecognized_cmd_line_options[i] = NULL;
+    }
 #endif
     clear_error(user);
     user_next_instance(user);
@@ -3607,6 +3616,12 @@ static MYINLINE void user_free_resources(fcs_user *const user)
     free(user->instances_list);
 #endif
     fc_solve_meta_compact_allocator_finish(&(user->meta_alloc));
+#ifndef FCS_USE_PRECOMPILED_CMD_LINE_THEME
+    for (size_t i = 0; i < COUNT(user->unrecognized_cmd_line_options); ++i)
+    {
+        free(user->unrecognized_cmd_line_options[i]);
+    }
+#endif
 }
 
 void DLLEXPORT freecell_solver_user_free(void *const api_instance)
@@ -3733,6 +3748,50 @@ void DLLEXPORT freecell_solver_user_set_solving_method(
 #if !(defined(FCS_BREAK_BACKWARD_COMPAT_1) && defined(FCS_FREECELL_ONLY))
 #ifndef HARD_CODED_NUM_FREECELLS
 
+#ifndef FCS_USE_PRECOMPILED_CMD_LINE_THEME
+int DLLEXPORT freecell_solver_user_set_unrecognized_cmd_line_flag(
+    void *const api_instance, const int flag_idx, const char *val)
+{
+    if (flag_idx != 0)
+    {
+        return 1;
+    }
+
+    fcs_user *const user = (fcs_user *)api_instance;
+    free(user->unrecognized_cmd_line_options[flag_idx]);
+    user->unrecognized_cmd_line_options[flag_idx] = strdup(val);
+
+    return 0;
+}
+
+DLLEXPORT int freecell_solver_user_get_unrecognized_cmd_line_flag_status(
+    void *const api_instance, const int flag_idx)
+{
+    if (flag_idx != 0)
+    {
+        return -1;
+    }
+
+    fcs_user *const user = (fcs_user *)api_instance;
+    const_AUTO(ret, user->unrecognized_cmd_line_options[flag_idx]);
+    return (ret ? 0 : 1);
+}
+
+DLLEXPORT char *freecell_solver_user_get_unrecognized_cmd_line_flag(
+    void *const api_instance, const int flag_idx)
+{
+    if (flag_idx != 0)
+    {
+        return NULL;
+    }
+
+    fcs_user *const user = (fcs_user *)api_instance;
+    const_AUTO(ret, user->unrecognized_cmd_line_options[flag_idx]);
+    return strdup(ret ? ret : "");
+}
+
+#endif
+
 int DLLEXPORT freecell_solver_user_set_num_freecells(
     void *const api_instance, const int freecells_num)
 {
diff --git a/fc-solve/source/t/t/fc-solve-output-Test-Trap.t b/fc-solve/source/t/t/fc-solve-output-Test-Trap.t
index f4c30738b..c5471765c 100644
--- a/fc-solve/source/t/t/fc-solve-output-Test-Trap.t
+++ b/fc-solve/source/t/t/fc-solve-output-Test-Trap.t
@@ -3,12 +3,14 @@
 use strict;
 use warnings;
 
-use Test::More tests => 36;
+use Test::More tests => 37;
 use Test::Trap
     qw( trap $trap :flow:stderr(systemsafe):stdout(systemsafe):warn );
 use FC_Solve::Paths
     qw( bin_board bin_exe_raw is_freecell_only is_without_dbm normalize_lf offload_arg samp_board $FC_SOLVE__RAW );
 
+use Path::Tiny qw/ path tempdir tempfile cwd /;
+
 my $MID24_BOARD = samp_board('24-mid.board');
 
 {
@@ -63,6 +65,25 @@ qq#Unknown option "--read-from-file4,amateur-star.sh". Type "$FC_SOLVE__RAW --he
         "Option without space is not accepted." );
 }
 
+{
+    my $dir = tempdir();
+    my $fh  = $dir->child("foo.txt");
+    $fh->spew_utf8("-invalidopt 25\n");
+
+    trap
+    {
+        system( $FC_SOLVE__RAW, '--read-from-file',
+            ( $fh->absolute->stringify ), $MID24_BOARD );
+    };
+
+    my $needle =
+qq#Unknown option "-invalidopt". Type "$FC_SOLVE__RAW --help" for usage information.#;
+
+    # TEST
+    like( $trap->stderr(), qr/^\Q$needle\E\r?$/ms,
+        "Option without space is not accepted." );
+}
+
 {
     trap
     {
