diff --git a/src/scripts/clear_budget_simulations_cache.ts b/src/scripts/clear_budget_simulations_cache.ts
index cd02c3be1b27c041f1b2791040d7f2962af2b7aa..820aaf0d57989280a1ca441d439f145f796a2216 100644
--- a/src/scripts/clear_budget_simulations_cache.ts
+++ b/src/scripts/clear_budget_simulations_cache.ts
@@ -19,12 +19,16 @@ if (fs.pathExistsSync(indexFilePath)) {
 
 // Remove every budget simulation from cache.
 const budgetsDir = path.join(simulationsBudgetDir, "responses")
-if (fs.lstatSync(budgetsDir).isDirectory()) {
-  fs.removeSync(budgetsDir)
+if (fs.pathExistsSync(budgetsDir)) {
+  if (fs.lstatSync(budgetsDir).isDirectory()) {
+    fs.removeSync(budgetsDir)
+  }
 }
 
 // Remove every test case simulation from cache.
 const testCasesDir = path.join(simulationsTestCasesDir, "responses")
-if (fs.lstatSync(testCasesDir).isDirectory()) {
-  fs.removeSync(testCasesDir)
+if (fs.pathExistsSync(testCasesDir)) {
+  if (fs.lstatSync(testCasesDir).isDirectory()) {
+    fs.removeSync(testCasesDir)
+  }
 }