Answers.Body: <p><strong>I found a fix:</strong></p>
  <p>I found out that this error is related to CiviMobileAPI. If this extension is deactivated everything works again. I found this error message regarding this:</p>
  <p>[php:warn] [pid 235173] [client] PHP Warning:  foreach() argument must be of type array|object, null given in /var/www/civicrm/wp-content/uploads/civicrm/ext/com.agiliway.civimobileapi/CRM/CiviMobileAPI/ApiWrapper/Note.php on line 35, referer: <a href="https://domain.com/wp-admin/admin.php?page=CiviCRM&amp;q=civicrm%2Fcontact%2Fview&amp;reset=1&amp;cid=3&amp;selectedChild=note" rel="nofollow noreferrer">https://domain.com/wp-admin/admin.php?page=CiviCRM&amp;q=civicrm%2Fcontact%2Fview&amp;reset=1&amp;cid=3&amp;selectedChild=note</a></p>
  <p>Edit the file:</p>
  <p>civicrm/ext/com.agiliway.civimobileapi/CRM/CiviMobileAPI/ApiWrapper/Note.php</p>
  <p><a href="https://lab.civicrm.org/extensions/civimobileapi/-/merge_requests/72/diffs" rel="nofollow noreferrer">https://lab.civicrm.org/extensions/civimobileapi/-/merge_requests/72/diffs</a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-10-25T11:44:39.300Z
Answers.LastActivityDate: 2023-10-25T11:44:39.300Z
Answers.UserDisplayName: Bernd
Body: <p>Civicrm 5.57.0 on Wordpress 6.1.1
  Within a single contact you can leave notes. since the last update, if you want to view the notes, this error appears in the log file and nothing come up. When I press edit, the content of the note comes up. This is now the workaround to view the notes, just to press edit.</p>
  <pre><code>Jan 13 08:14:53  [error]
  $Fatal Error Details = array:3 [
    &quot;message&quot; =&gt; &quot;Expected to find one Note record, but there were multiple.&quot;
    &quot;code&quot; =&gt; null
    &quot;exception&quot; =&gt; CRM_Core_Exception {#8316
      -errorData: array:1 [
        &quot;error_code&quot; =&gt; 0
      ]
      #cause: null
      -_trace: null
      #message: &quot;Expected to find one Note record, but there were multiple.&quot;
      #code: 0
      #file: &quot;/var/www/civicrm/wp-content/plugins/civicrm/civicrm/CRM/Utils/Array.php&quot;
      #line: 1232
      trace: {
        /var/www/civicrm/wp-content/plugins/civicrm/civicrm/CRM/Utils/Array.php:1232 {
          › else {
          ›   throw new \CRM_Core_Exception(&quot;Expected to find one {$recordTypeLabel}, but there were multiple.&quot;);
          › }
        }
        /var/www/civicrm/wp-content/plugins/civicrm/civicrm/Civi/Api4/Generic/Result.php:90 { …}
        /var/www/civicrm/wp-content/plugins/civicrm/civicrm/CRM/Contact/Page/View/Note.php:37 { …}
        /var/www/civicrm/wp-content/plugins/civicrm/civicrm/CRM/Contact/Page/View/Note.php:187 { …}
        /var/www/civicrm/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php:319 { …}
        /var/www/civicrm/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php:69 { …}
        /var/www/civicrm/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php:36 { …}
        /var/www/civicrm/wp-content/plugins/civicrm/civicrm.php:1199 { …}
        /var/www/civicrm/wp-includes/class-wp-hook.php:308 { …}
        /var/www/civicrm/wp-includes/class-wp-hook.php:332 { …}
        /var/www/civicrm/wp-includes/plugin.php:517 { …}
        /var/www/civicrm/wp-admin/admin.php:259 { …}
      }
    }
  ]
  
  
  Jan 13 08:14:53  [debug] $backTrace = #0 /var/www/civicrm/wp-content/plugins/civicrm/civicrm/CRM/Core/Error.php(441): CRM_Core_Error::backtrace(&quot;backTrace&quot;, TRUE)
  #1 /var/www/civicrm/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(39): CRM_Core_Error::handleUnhandledException(Object(CRM_Core_Exception))
  #2 /var/www/civicrm/wp-content/plugins/civicrm/civicrm.php(1199): CRM_Core_Invoke::invoke((Array:4))
  #3 /var/www/civicrm/wp-includes/class-wp-hook.php(308): CiviCRM_For_WordPress-&gt;invoke(&quot;&quot;)
  #4 /var/www/civicrm/wp-includes/class-wp-hook.php(332): WP_Hook-&gt;apply_filters(&quot;&quot;, (Array:1))
  #5 /var/www/civicrm/wp-includes/plugin.php(517): WP_Hook-&gt;do_action((Array:1))
  #6 /var/www/civicrm/wp-admin/admin.php(259): do_action(&quot;toplevel_page_CiviCRM&quot;)
  #7 {main}
  </code></pre>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-01-13T09:53:33.387Z
Comments.Text: Can you reproduce this on https://wpmaster.demo.civicrm.org ? I tried but it seems to work ok.  Probably worth upgrading to 5.57.1 anyway as it has a few fixes.
Comments.UserDisplayName: Aidan
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-01-31T14:48:34.023Z
Comments.Text: No sorry, I can´t reproduce this on wpmaster.demo.civicrm.org. But this is on version 5.59.alpha. Next I will update to 5.57.2 and hope this bug is gone! I will report!
Comments.UserDisplayName: Bernd
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-02-06T09:14:09.683Z
Comments.Text: So, I updated to Version 5.57.3, same error and it´s not possible to view the notes...
Comments.UserDisplayName: Bernd
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-04-11T21:26:01.080Z
Comments.Text: I have the same issue. I have verified that only one tuple exists in the database for the user viewed.
Comments.UserDisplayName: Webmaster COVS
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-05-02T08:19:32.653Z
Comments.Text: Did anyone solve this issue? I still have it on a CiviCRM 5.58.1.
Comments.UserDisplayName: Andreas
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-05-11T12:02:10.213Z
Comments.Text: Yes, it still exists! I am on CiviCRm  5.58.1 and the same Error!
  The Workaround is don't view the message, just press edit.
Comments.UserDisplayName: Bernd
Tags: <wordpress><contacts><error>
Title: Civicrm 5.57.0 Error on Contact Notes View
ThreadText: # Civicrm 5.57.0 Error on Contact Notes View
  
  (Asked by: username_0 on 2023-01-13)
  
  Civicrm 5.57.0 on Wordpress 6.1.1
  Within a single contact you can leave notes. since the last update, if you want to view the notes, this error appears in the log file and nothing come up. When I press edit, the content of the note comes up. This is now the workaround to view the notes, just to press edit.
  
  ```
  Jan 13 08:14:53  [error]
  $Fatal Error Details = array:3 [
    "message" => "Expected to find one Note record, but there were multiple."
    "code" => null
    "exception" => CRM_Core_Exception {#8316
      -errorData: array:1 [
        "error_code" => 0
      ]
      #cause: null
      -_trace: null
      #message: "Expected to find one Note record, but there were multiple."
      #code: 0
      #file: "/var/www/civicrm/wp-content/plugins/civicrm/civicrm/CRM/Utils/Array.php"
      #line: 1232
      trace: {
        /var/www/civicrm/wp-content/plugins/civicrm/civicrm/CRM/Utils/Array.php:1232 {
          › else {
          ›   throw new \CRM_Core_Exception("Expected to find one {$recordTypeLabel}, but there were multiple.");
          › }
        }
        /var/www/civicrm/wp-content/plugins/civicrm/civicrm/Civi/Api4/Generic/Result.php:90 { …}
        /var/www/civicrm/wp-content/plugins/civicrm/civicrm/CRM/Contact/Page/View/Note.php:37 { …}
        /var/www/civicrm/wp-content/plugins/civicrm/civicrm/CRM/Contact/Page/View/Note.php:187 { …}
        /var/www/civicrm/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php:319 { …}
        /var/www/civicrm/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php:69 { …}
        /var/www/civicrm/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php:36 { …}
        /var/www/civicrm/wp-content/plugins/civicrm/civicrm.php:1199 { …}
        /var/www/civicrm/wp-includes/class-wp-hook.php:308 { …}
        /var/www/civicrm/wp-includes/class-wp-hook.php:332 { …}
        /var/www/civicrm/wp-includes/plugin.php:517 { …}
        /var/www/civicrm/wp-admin/admin.php:259 { …}
      }
    }
  ]
  
  Jan 13 08:14:53  [debug] $backTrace = #0 /var/www/civicrm/wp-content/plugins/civicrm/civicrm/CRM/Core/Error.php(441): CRM_Core_Error::backtrace("backTrace", TRUE)
  #1 /var/www/civicrm/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(39): CRM_Core_Error::handleUnhandledException(Object(CRM_Core_Exception))
  #2 /var/www/civicrm/wp-content/plugins/civicrm/civicrm.php(1199): CRM_Core_Invoke::invoke((Array:4))
  #3 /var/www/civicrm/wp-includes/class-wp-hook.php(308): CiviCRM_For_WordPress->invoke("")
  #4 /var/www/civicrm/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters("", (Array:1))
  #5 /var/www/civicrm/wp-includes/plugin.php(517): WP_Hook->do_action((Array:1))
  #6 /var/www/civicrm/wp-admin/admin.php(259): do_action("toplevel_page_CiviCRM")
  #7 {main}
  
  ```
  
  **Tags:** wordpress, contacts, error
  
  > **Comments:**
  > **username_1**: Can you reproduce this on https://wpmaster.demo.civicrm.org ? I tried but it seems to work ok.  Probably worth upgrading to 5.57.1 anyway as it has a few fixes.  
  > **username_0**: No sorry, I can´t reproduce this on wpmaster.demo.civicrm.org. But this is on version 5.59.alpha. Next I will update to 5.57.2 and hope this bug is gone! I will report!  
  > **username_0**: So, I updated to Version 5.57.3, same error and it´s not possible to view the notes...  
  > **username_2**: I have the same issue. I have verified that only one tuple exists in the database for the user viewed.  
  > **username_3**: Did anyone solve this issue? I still have it on a CiviCRM 5.58.1.  
  > **username_0**: Yes, it still exists! I am on CiviCRm  5.58.1 and the same Error! The Workaround is don't view the message, just press edit.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2023-10-25. Score: 2 | Accepted answer
  
  **I found a fix:**
  
  I found out that this error is related to CiviMobileAPI. If this extension is deactivated everything works again. I found this error message regarding this:
  
  [php:warn] [pid 235173] [client] PHP Warning: foreach() argument must be of type array|object, null given in /var/www/civicrm/wp-content/uploads/civicrm/ext/com.agiliway.civimobileapi/CRM/CiviMobileAPI/ApiWrapper/Note.php on line 35, referer: <https://domain.com/wp-admin/admin.php?page=CiviCRM&q=civicrm%2Fcontact%2Fview&reset=1&cid=3&selectedChild=note>
  
  Edit the file:
  
  civicrm/ext/com.agiliway.civimobileapi/CRM/CiviMobileAPI/ApiWrapper/Note.php
  
  <https://lab.civicrm.org/extensions/civimobileapi/-/merge_requests/72/diffs>
  
  
  ---
  
  