Answers.Body: <p>Recreating the equivalent memberships and then updating them with SQL was the solution</p>
  <pre><code>UPDATE `contact_membership` SET `membership.id` = 'Y' WHERE `membership.id` = 'X'
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-11-05T15:53:32.533Z
Answers.LastActivityDate: 2021-11-05T15:53:32.533Z
Answers.UserDisplayName: Guillaume Sorel
Answers.Body: <p>The top (0) entry of your trace says that it's trying to run an civicrm api command without enough arguments. It's trying to get memberships matching some collection of ids, but the code isn't providing anything to match.</p>
  <p>The next entry shows you how it go there - it's trying to get the memberships that it has just created.</p>
  <p>My guess is that the error is actually happening earlier than this trace shows - i.e. a membership is not getting created, but the code is then trying to work with whatever membership it assumes has been created, and is failing.</p>
  <p>There are a few issues here:</p>
  <ol>
  <li><p>Figuring out why the membership wasn't created - likely there is an earlier warning in the error log. It might be related to a core error or an extension error, or even a WP-Civi integration issue.</p>
  </li>
  <li><p>Figuring out why the code kept going after it failed earlier. That's for bonus points.</p>
  </li>
  </ol>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-11-04T10:50:08.467Z
Answers.Text: thanks Alan, I'm starting to have a better overview of this strange issue
Answers.UserDisplayName: Guillaume Sorel
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-11-03T19:04:41.303Z
Answers.LastActivityDate: 2021-11-03T19:04:41.303Z
Answers.UserDisplayName: Alan Dixon
Body: <p>When I try to add a membership from the back office as an admin on CiviCRM 5.42.1 on WP 5.5.6, I'm getting this error 500 I don't know how to interpret.</p>
  <p>Where could I dig in?</p>
  <p>EDIT 1: Trying through API V3 worked like a charm, is this a front end issue (js / AJAX)?</p>
  <pre><code>***ERROR***
  message:            invalid criteria for IN
  code:                
  exception:          CiviCRM_API3_Exception Object
  (
  [extraParams:CiviCRM_API3_Exception:private] =&gt; Array
      (
          [is_error] =&gt; 1
          [error_message] =&gt; invalid criteria for IN
          [error_code] =&gt; undefined
      )
  
  [message:protected] =&gt; invalid criteria for IN
  [string:Exception:private] =&gt; 
  [code:protected] =&gt; 0
  [file:protected] =&gt; /home/domain/domain/wp-content/plugins/civicrm/civicrm/api/api.php
  [line:protected] =&gt; 134
  [trace:Exception:private] =&gt; Array
      (
          [0] =&gt; Array
              (
                  [file] =&gt; /home/domain/domain/wp-content/plugins/civicrm/civicrm/CRM/Member/Form/Membership.php
                  [line] =&gt; 1834
                  [function] =&gt; civicrm_api3
                  [args] =&gt; Array
                      (
                          [0] =&gt; Membership
                          [1] =&gt; get
                          [2] =&gt; Array
                              (
                                  [id] =&gt; Array
                                      (
                                          [IN] =&gt; Array
                                              (
                                              )
  
                                      )
  
                                  [version] =&gt; 3
                              )
  
                      )
  
              )
  
          [1] =&gt; Array
              (
                  [file] =&gt; /home/domain/domain/wp-content/plugins/civicrm/civicrm/CRM/Member/Form/Membership.php
                  [line] =&gt; 1523
                  [function] =&gt; getCreatedMemberships
                  [class] =&gt; CRM_Member_Form_Membership
                  [type] =&gt; -&gt;
                  [args] =&gt; Array
                      (
                      )
  
              )
  
          [2] =&gt; Array
              (
                  [file] =&gt; /home/domain/domain/wp-content/plugins/civicr...
  </code></pre>
  
Tags: <civimember>
Title: error on membership in backoffice
ThreadText: # error on membership in backoffice
  
  (Asked by: username_0 on 2021-11-03)
  
  When I try to add a membership from the back office as an admin on CiviCRM 5.42.1 on WP 5.5.6, I'm getting this error 500 I don't know how to interpret.
  
  Where could I dig in?
  
  EDIT 1: Trying through API V3 worked like a charm, is this a front end issue (js / AJAX)?
  
  ```
  ***ERROR***
  message:            invalid criteria for IN
  code:                
  exception:          CiviCRM_API3_Exception Object
  (
  [extraParams:CiviCRM_API3_Exception:private] => Array
      (
          [is_error] => 1
          [error_message] => invalid criteria for IN
          [error_code] => undefined
      )
  
  [message:protected] => invalid criteria for IN
  [string:Exception:private] => 
  [code:protected] => 0
  [file:protected] => /home/domain/domain/wp-content/plugins/civicrm/civicrm/api/api.php
  [line:protected] => 134
  [trace:Exception:private] => Array
      (
          [0] => Array
              (
                  [file] => /home/domain/domain/wp-content/plugins/civicrm/civicrm/CRM/Member/Form/Membership.php
                  [line] => 1834
                  [function] => civicrm_api3
                  [args] => Array
                      (
                          [0] => Membership
                          [1] => get
                          [2] => Array
                              (
                                  [id] => Array
                                      (
                                          [IN] => Array
                                              (
                                              )
  
                                      )
  
                                  [version] => 3
                              )
  
                      )
  
              )
  
          [1] => Array
              (
                  [file] => /home/domain/domain/wp-content/plugins/civicrm/civicrm/CRM/Member/Form/Membership.php
                  [line] => 1523
                  [function] => getCreatedMemberships
                  [class] => CRM_Member_Form_Membership
                  [type] => ->
                  [args] => Array
                      (
                      )
  
              )
  
          [2] => Array
              (
                  [file] => /home/domain/domain/wp-content/plugins/civicr...
  
  ```
  
  **Tags:** civimember
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_0 on 2021-11-05. Score: 1 | Accepted answer
  
  Recreating the equivalent memberships and then updating them with SQL was the solution
  
  ```
  UPDATE `contact_membership` SET `membership.id` = 'Y' WHERE `membership.id` = 'X'
  
  ```
  
  
  ---
  
  ### Answer by username_1 on 2021-11-03. Score: 2
  
  The top (0) entry of your trace says that it's trying to run an civicrm api command without enough arguments. It's trying to get memberships matching some collection of ids, but the code isn't providing anything to match.
  
  The next entry shows you how it go there - it's trying to get the memberships that it has just created.
  
  My guess is that the error is actually happening earlier than this trace shows - i.e. a membership is not getting created, but the code is then trying to work with whatever membership it assumes has been created, and is failing.
  
  There are a few issues here:
  
  1. Figuring out why the membership wasn't created - likely there is an earlier warning in the error log. It might be related to a core error or an extension error, or even a WP-Civi integration issue.
  2. Figuring out why the code kept going after it failed earlier. That's for bonus points.
  
  > **Comments:**
  > **username_0**: thanks username_1, I'm starting to have a better overview of this strange issue  
  
  ---
  
  