diff --git a/src/main.ml b/src/main.ml
index b110dbcf4f1b1e4128d160d009b51069bc8556e6..9afb6b402c3bcde5b423e85204e1c845aa4e0368 100644
--- a/src/main.ml
+++ b/src/main.ml
@@ -102,7 +102,7 @@ let memlimit_of_string s =
   | [ v ], ([] | [ "M" ] | [ "MB" ]) -> Int.of_string v
   | [ v ], ([ "G" ] | [ "GB" ]) -> Int.of_string v * 1000
   | [ v ], ([ "T" ] | [ "TB" ]) -> Int.of_string v * 1000000
-  | _ -> failwith "Unrecognized memory limit"
+  | _ -> invalid_arg "Unrecognized memory limit"
 
 let timelimit_of_string s =
   let s = String.strip s in
@@ -118,7 +118,7 @@ let timelimit_of_string s =
   | [ v ], ([] | [ "s" ]) -> Int.of_string v
   | [ v ], [ "m" ] -> Int.of_string v * 60
   | [ v ], [ "h" ] -> Int.of_string v * 3600
-  | _ -> failwith "Unrecognized time limit"
+  | _ -> invalid_arg "Unrecognized time limit"
 
 let verify format loadpath memlimit timelimit prover dataset_csv files =
   let debug = log_level_is_debug () in