diff --git a/core/lib/Drupal/Core/Recipe/InputConfigurator.php b/core/lib/Drupal/Core/Recipe/InputConfigurator.php
index 4e429ef70cf0f9456e4218a38922fb5ad596d27e..9b324ed29aa3d00f26219930a7ac516f0e7085b6 100644
--- a/core/lib/Drupal/Core/Recipe/InputConfigurator.php
+++ b/core/lib/Drupal/Core/Recipe/InputConfigurator.php
@@ -133,15 +133,15 @@ public function describeAll(): array {
    *   constraints.
    */
   public function collectAll(InputCollectorInterface $collector, array &$processed = []): void {
-    if (is_array($this->values)) {
-      throw new \LogicException('Input values cannot be changed once they have been set.');
-    }
-
     // Don't bother collecting values for a recipe we've already seen.
     if (in_array($this->prefix, $processed, TRUE)) {
       return;
     }
 
+    if (is_array($this->values)) {
+      throw new \LogicException('Input values cannot be changed once they have been set.');
+    }
+
     // First, collect values for the recipe's dependencies.
     /** @var \Drupal\Core\Recipe\Recipe $dependency */
     foreach ($this->dependencies->recipes as $dependency) {