diff --git a/src/DeprecationAnalyzer.php b/src/DeprecationAnalyzer.php
index efca7a3..1cc502d 100644
--- a/src/DeprecationAnalyzer.php
+++ b/src/DeprecationAnalyzer.php
@@ -276,13 +276,19 @@ final class DeprecationAnalyzer {
        $this->logger->error('PHPStan failed: %results', ['%results' => print_r($output, TRUE)]);
        $json = [
          'files' => [
-           'PHPStan failed' => 'PHP API deprecations cannot be checked. Reason: ' . print_r($output, TRUE),
-           'line' => 0,
-          ],
-          'totals' => [
-            'errors' => 1,
-            'file_errors' => 1,
-          ],
+           // Add a failure message with the nonexistent 'PHPStan failed'
+           // filename, so the error conforms to the expected format.
+           'PHPStan failed' => [
+             'messages' => [
+               'message' => 'PHP API deprecations cannot be checked. Reason: ' . print_r($output, TRUE),
+               'line' => 0,
+             ],
+           ]
+         ],
+         'totals' => [
+           'errors' => 1,
+           'file_errors' => 1,
+         ],
        ];
     }
     $result = [
@@ -398,36 +404,34 @@ final class DeprecationAnalyzer {
     $result['data']['totals']['upgrade_status_next'] = ProjectCollector::NEXT_RELAX;
 
     foreach ($result['data']['files'] as $path => &$errors) {
-      if (!empty($errors['messages'])) {
-        foreach ($errors['messages'] as &$error) {
-
-          // Overwrite message with processed text. Save category.
-          [$message, $category] = $this->categorizeMessage($error['message'], $extension);
-          $error['message'] = $message;
-          $error['upgrade_status_category'] = $category;
-
-          // If the category was 'rector' that means at least one error was
-          // identified as covered by rector, so next step should be to run
-          // rector on this project.
-          if ($category == 'rector') {
-            $result['data']['totals']['upgrade_status_next'] = ProjectCollector::NEXT_RECTOR;
-          }
-          // If the category was not rector, if the next step is still to
-          // relax, modify that to fix manually.
-          elseif ($result['data']['totals']['upgrade_status_next'] == ProjectCollector::NEXT_RELAX) {
-            $result['data']['totals']['upgrade_status_next'] = ProjectCollector::NEXT_MANUAL;
-          }
+      foreach ($errors['messages'] as &$error) {
+
+        // Overwrite message with processed text. Save category.
+        [$message, $category] = $this->categorizeMessage($error['message'], $extension);
+        $error['message'] = $message;
+        $error['upgrade_status_category'] = $category;
+
+        // If the category was 'rector' that means at least one error was
+        // identified as covered by rector, so next step should be to run
+        // rector on this project.
+        if ($category == 'rector') {
+          $result['data']['totals']['upgrade_status_next'] = ProjectCollector::NEXT_RECTOR;
+        }
+        // If the category was not rector, if the next step is still to
+        // relax, modify that to fix manually.
+        elseif ($result['data']['totals']['upgrade_status_next'] == ProjectCollector::NEXT_RELAX) {
+          $result['data']['totals']['upgrade_status_next'] = ProjectCollector::NEXT_MANUAL;
+        }
 
-          // Sum up the error based on the category it ended up in. Split the
-          // categories into two high level buckets needing attention now or
-          // later for Drupal 9 compatibility. Ignore Drupal 10 here.
-          @$result['data']['totals']['upgrade_status_category'][$category]++;
-          if (in_array($category, ['safe', 'old', 'rector'])) {
-            @$result['data']['totals']['upgrade_status_split']['error']++;
-          }
-          elseif (in_array($category, ['later', 'uncategorized'])) {
-            @$result['data']['totals']['upgrade_status_split']['warning']++;
-          }
+        // Sum up the error based on the category it ended up in. Split the
+        // categories into two high level buckets needing attention now or
+        // later for Drupal 9 compatibility. Ignore Drupal 10 here.
+        @$result['data']['totals']['upgrade_status_category'][$category]++;
+        if (in_array($category, ['safe', 'old', 'rector'])) {
+          @$result['data']['totals']['upgrade_status_split']['error']++;
+        }
+        elseif (in_array($category, ['later', 'uncategorized'])) {
+          @$result['data']['totals']['upgrade_status_split']['warning']++;
         }
       }
     }
diff --git a/upgrade_status.install b/upgrade_status.install
index c97ec54..dee64c2 100644
--- a/upgrade_status.install
+++ b/upgrade_status.install
@@ -63,3 +63,10 @@ function upgrade_status_update_8101() {
 function upgrade_status_update_8301() {
   \Drupal::keyValue('upgrade_status_scan_results')->deleteAll();
 }
+
+/**
+ * Delete state, because PHPStan fail state was incorrectly formatted.
+ */
+function upgrade_status_update_8302() {
+  \Drupal::keyValue('upgrade_status_scan_results')->deleteAll();
+}
