diff --git a/src/ScanResultFormatter.php b/src/ScanResultFormatter.php
index e9551f6..7e0e526 100644
--- a/src/ScanResultFormatter.php
+++ b/src/ScanResultFormatter.php
@@ -161,6 +161,9 @@ class ScanResultFormatter {
     // Otherwise prepare list of errors in groups.
     $groups = [];
     foreach ($result['data']['files'] as $filepath => $errors) {
+      if (!isset($errors['messages'])) {
+        continue;
+      }
       foreach ($errors['messages'] as $error) {
 
         // Remove the Drupal root directory. If this is a composer setup, then
@@ -443,6 +446,10 @@ class ScanResultFormatter {
 
     $hasFixRector = FALSE;
     foreach ($result['data']['files'] as $filepath => $errors) {
+      if (!isset($errors['messages'])) {
+        continue;
+      }
+
       // Remove the Drupal root directory name. If this is a composer setup,
       // then the webroot is in a web/ directory, add that back in for easy
       // path copy-pasting.
