Body: <p>This error only happens when:</p>
  <p>Registering multiple participants for an event</p>
  <ul>
  <li>2nd (or later) Participant has an email that already exists in the
  database.</li>
  <li>If the 1st participant (primary one registering others) exists it
  seems OK.</li>
  </ul>
  <p>Event can be Free or Paid</p>
  <p>EDIT: Have tried this with various Duplicate Matching rules, using the default 'unsupervised' rule available for events or one that checks for a matching name and email:
  <a href="https://i.sstatic.net/SpYuk.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/SpYuk.png" alt="enter image description here" /></a></p>
  <p>Any rule that looks for a matching email seems to trigger the error.</p>
  <p>The only way to complete the multiple participant registrations is to either:</p>
  <ul>
  <li>Make the email optional for additional participants (not desirable as
  duplicate contacts are created) or</li>
  <li>Enter a unique email not attached to an existing contact (not
  practical as an existing email is often entered)</li>
  </ul>
  <p>The error displayed is
  &quot;Could not find valid value for id&quot;.
  #file: &quot;/httpdocs/wp-content/plugins/civicrm/civicrm/CRM/Utils/Request.php&quot;
  #line: 104</p>
  <p>This is called from /httpdocs/wp-content/plugins/civicrm/civicrm/CRM/Event/StateMachine/Registration.php:28</p>
  <p>The redirect url is consistently generated without a value for qfKey e.g.
  <a href="https://mysite.com/wp-admin/admin.php?page=CiviCRM&amp;q=civicrm%2Fevent%2Fregister&amp;_qf_Register_display=true&amp;qfKey" rel="nofollow noreferrer">https://mysite.com/wp-admin/admin.php?page=CiviCRM&amp;q=civicrm%2Fevent%2Fregister&amp;_qf_Register_display=true&amp;qfKey</a></p>
  <p>I'm assuming that is causing the ID of the event to not be found throwing the error above.</p>
  <p>I also replicated the same problem on the tadpole.cc WP demo which is running the same versions but with demo content.</p>
  <p>The base url and base pages are set as per the documentation in the config.
  This is running on:</p>
  <ul>
  <li>CiviCrm v5.40.4 (also on v5.38.0, v5.38.1)</li>
  <li>WP 5.7.2 (multisite, by subdirectory. The Civicrm site is the main
  website on the network)</li>
  </ul>
  <p>I've also verified that the same issue happens on a single site setup, so I don't think it's specific to a multi-site setup.</p>
  <p>This is the full error in the logs</p>
  <pre><code>    $Fatal Error Details = array:3 [
    &quot;message&quot; =&gt; &quot;Could not find valid value for id&quot;
    &quot;code&quot; =&gt; null
    &quot;exception&quot; =&gt; CRM_Core_Exception {#14562
      -errorData: array:1 [
        &quot;error_code&quot; =&gt; 0
      ]
      #cause: null
      -_trace: null
      #message: &quot;Could not find valid value for id&quot;
      #code: 0
      #file: &quot;/httpdocs/wp-content/plugins/civicrm/civicrm/CRM/Utils/Request.php&quot;
      #line: 104
      trace: {
        /httpdocs/wp-content/plugins/civicrm/civicrm/CRM/Utils/Request.php:104 {
          ›   if (!isset($value) &amp;&amp; $abort) {
          ›   throw new CRM_Core_Exception(ts('Could not find valid value for %1', [1 =&gt; $name]));
          › }
        }
        /httpdocs/wp-content/plugins/civicrm/civicrm/CRM/Event/StateMachine/Registration.php:28 { …}
        /httpdocs/wp-content/plugins/civicrm/civicrm/CRM/Event/Controller/Registration.php:27 { …}
        /httpdocs/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php:308 { …}
        /httpdocs/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php:69 { …}
        /httpdocs/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php:36 { …}
        /httpdocs/wp-content/plugins/civicrm/civicrm.php:1178 { …}
        /httpdocs/wp-includes/class-wp-hook.php:292 { …}
        /httpdocs/wp-includes/class-wp-hook.php:316 { …}
        /httpdocs/wp-includes/plugin.php:484 { …}
        /httpdocs/wp-admin/admin.php:259 { …}
      }
    }
  ]
  </code></pre>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-09-06T02:06:06.023Z
Comments.Text: It may help if you can just specify the set up for matching rules so this can easily be replicated by others. you said "Have tried this with various Duplicate Matching rules" but will save someone else time if you can say 'set it to X, and then it fails'
Comments.UserDisplayName: petednz - fuzion
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-09-06T02:16:38.163Z
Comments.Text: I've added info on the rules we've tried. Any rule that looks for an email match seems to trigger the error.
Comments.UserDisplayName: Frosty
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-09-06T03:15:12.443Z
Comments.Text: i tried replicating on dmaster.demo.civicrm.org and could not. i tried with both the Unsupervised 'email only' and a new General 'email only'. in both cases by entering an email of an existing contact, that contact was updated with the names i gave them and with the Participant record. not sure what we are doing differently. if it is still unrefreshed you can try when logged in via https://dmaster.demo.civicrm.org/civicrm/event/info?reset=1&id=3 - you can PM me via chat.civicrm.org if you want a 'faster' conversation about this (ie without SE delays)
Comments.UserDisplayName: petednz - fuzion
Tags: <civievent>
Title: Registration error for multiple participants when their email already exists
ThreadText: # Registration error for multiple participants when their email already exists
  
  (Asked by: username_0 on 2021-09-06)
  
  This error only happens when:
  Registering multiple participants for an event
  
  2nd (or later) Participant has an email that already exists in the
  database.
  If the 1st participant (primary one registering others) exists it
  seems OK.
  
  Event can be Free or Paid
  EDIT: Have tried this with various Duplicate Matching rules, using the default 'unsupervised' rule available for events or one that checks for a matching name and email:
  
  Any rule that looks for a matching email seems to trigger the error.
  The only way to complete the multiple participant registrations is to either:
  
  Make the email optional for additional participants (not desirable as
  duplicate contacts are created) or
  Enter a unique email not attached to an existing contact (not
  practical as an existing email is often entered)
  
  The error displayed is
  "Could not find valid value for id".
  #file: "/httpdocs/wp-content/plugins/civicrm/civicrm/CRM/Utils/Request.php"
  #line: 104
  This is called from /httpdocs/wp-content/plugins/civicrm/civicrm/CRM/Event/StateMachine/Registration.php:28
  The redirect url is consistently generated without a value for qfKey e.g.
  https://mysite.com/wp-admin/admin.php?page=CiviCRM&q=civicrm%2Fevent%2Fregister&_qf_Register_display=true&qfKey
  I'm assuming that is causing the ID of the event to not be found throwing the error above.
  I also replicated the same problem on the tadpole.cc WP demo which is running the same versions but with demo content.
  The base url and base pages are set as per the documentation in the config.
  This is running on:
  
  CiviCrm v5.40.4 (also on v5.38.0, v5.38.1)
  WP 5.7.2 (multisite, by subdirectory. The Civicrm site is the main
  website on the network)
  
  I've also verified that the same issue happens on a single site setup, so I don't think it's specific to a multi-site setup.
  This is the full error in the logs
      $Fatal Error Details = array:3 [
    "message" => "Could not find valid value for id"
    "code" => null
    "exception" => CRM_Core_Exception {#14562
      -errorData: array:1 [
        "error_code" => 0
      ]
      #cause: null
      -_trace: null
      #message: "Could not find valid value for id"
      #code: 0
      #file: "/httpdocs/wp-content/plugins/civicrm/civicrm/CRM/Utils/Request.php"
      #line: 104
      trace: {
        /httpdocs/wp-content/plugins/civicrm/civicrm/CRM/Utils/Request.php:104 {
          ›   if (!isset($value) && $abort) {
          ›   throw new CRM_Core_Exception(ts('Could not find valid value for %1', [1 => $name]));
          › }
        }
        /httpdocs/wp-content/plugins/civicrm/civicrm/CRM/Event/StateMachine/Registration.php:28 { …}
        /httpdocs/wp-content/plugins/civicrm/civicrm/CRM/Event/Controller/Registration.php:27 { …}
        /httpdocs/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php:308 { …}
        /httpdocs/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php:69 { …}
        /httpdocs/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php:36 { …}
        /httpdocs/wp-content/plugins/civicrm/civicrm.php:1178 { …}
        /httpdocs/wp-includes/class-wp-hook.php:292 { …}
        /httpdocs/wp-includes/class-wp-hook.php:316 { …}
        /httpdocs/wp-includes/plugin.php:484 { …}
        /httpdocs/wp-admin/admin.php:259 { …}
      }
    }
  ]
  
  **Tags:** civievent
  
  > **Comments:**
  > **username_1**: It may help if you can just specify the set up for matching rules so this can easily be replicated by others. you said "Have tried this with various Duplicate Matching rules" but will save someone else time if you can say 'set it to X, and then it fails'  
  > **username_0**: I've added info on the rules we've tried. Any rule that looks for an email match seems to trigger the error.  
  > **username_1**: i tried replicating on dmaster.demo.civicrm.org and could not. i tried with both the Unsupervised 'email only' and a new General 'email only'. in both cases by entering an email of an existing contact, that contact was updated with the names i gave them and with the Participant record. not sure what we are doing differently. if it is still unrefreshed you can try when logged in via https://dmaster.demo.civicrm.org/civicrm/event/info?reset=1&id=3 - you can PM me via chat.civicrm.org if you want a 'faster' conversation about this (ie without SE delays)  
  
  ---
  
  ## 0 answers
  
  