diff --git a/core/lib/Drupal/Core/Form/FormState.php b/core/lib/Drupal/Core/Form/FormState.php
index 4a17d6b..d1f6e20 100644
--- a/core/lib/Drupal/Core/Form/FormState.php
+++ b/core/lib/Drupal/Core/Form/FormState.php
@@ -1117,13 +1117,9 @@ public function clearErrors() {
    */
   public function getError(array $element) {
     if ($errors = $this->getErrors()) {
-      $parents = array();
-      foreach ($element['#parents'] as $parent) {
-        $parents[] = $parent;
-        $key = implode('][', $parents);
-        if (isset($errors[$key])) {
-          return $errors[$key];
-        }
+      $key = implode('][', $element['#parents']);
+      if (isset($errors[$key])) {
+        return $errors[$key];
       }
     }
   }
