Answers.Body: <p>Have you customised the greetings or addressee formats?  Go to <code>Administer &gt; Communications &gt; Email Greeting Formats, Postal Greeting Formats, Addressee Formats</code> and compare your values with those on <a href="https://dmaster.demo.civicrm.org" rel="nofollow noreferrer">https://dmaster.demo.civicrm.org</a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-03-24T17:35:10.460Z
Answers.Text: Thanks Aiden - you are right, there was an extra entry in Addressee formats. One place I'd not looked as I knew I'd never changed anything on that screen. Deleted it and all is well again.
  Wonder how that got there, is there any way for me to find out?
Answers.UserDisplayName: SteveTheBoater
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-03-25T14:22:12.067Z
Answers.Text: The options are stored in the `civicrm_option_value` table so if you're using extended logging you could see what `log_civicrm_option_value` tells you.
Answers.UserDisplayName: Aidan
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-03-25T21:40:52.887Z
Answers.Text: Fascinating - that entry has been in the database since 2015, not long after we set the system up, and never caused a problem before! Goodness knows why it was added, but it was my account that did it, though I have absolutely no recollection of it. Some random bit of advice from somewhere while I was finding my feet. Thanks again
Answers.UserDisplayName: SteveTheBoater
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-03-24T12:11:30.797Z
Answers.LastActivityDate: 2022-03-24T12:11:30.797Z
Answers.UserDisplayName: Aidan
Body: <p>Running latest CiviCRM on latest Drupal 7, php 7.4.28. This error was reported by one of our volunteers when trying to edit a contact yesterday. Logged in as Admin I can replicate on any contact, and have confirmed that our testing version of the site does exactly the same.
  Having checked recent records added to the contacts table, disabled all extensions, cleared caches, etc. the problem does not go away. I've rolled back to 5.47.0, which was the previous version we were running and it is on there too, so I'm not sure when this issue first appeared (small organisation and it is very possible that this was simply not noticed by our volunteers - I don't regularly use the system myself except to change settings.)</p>
  <p>I'm also seeing the same message in an alert from time to time, for example I just got it when loading the Dashboard.</p>
  <p>Enabling debugging and backtrace, then looking in the logs, I get this, but am unclear what it is telling me or where to go next [server path redacted]. Any suggestions?</p>
  <pre><code>Mar 24 07:14:13  [error] 
  $Fatal Error Details = array:3 [
    &quot;message&quot; =&gt; &quot;Malformed token parameters ({contact.first_name|truncate:1:&quot;&quot;:true})&quot;
    &quot;code&quot; =&gt; null
    &quot;exception&quot; =&gt; CRM_Core_Exception {#1862
      -errorData: array:1 [
        &quot;error_code&quot; =&gt; 0
      ]
      #cause: null
      -_trace: null
      #message: &quot;Malformed token parameters ({contact.first_name|truncate:1:&quot;&quot;:true})&quot;
      #code: 0
      #file: &quot;/[myserverpath]/public/sites/all/modules/civicrm/Civi/Token/TokenProcessor.php&quot;
      #line: 444
      trace: {
        /[myserverpath]/public/sites/all/modules/civicrm/Civi/Token/TokenProcessor.php:444 {
          › if ($unmatched) {
          ›   throw new \CRM_Core_Exception('Malformed token parameters (' . $m[0] . ')');
          › }
        }
        Civi\Token\TokenProcessor-&gt;Civi\Token\{closure}() {}
        /[myserverpath]/public/sites/all/modules/civicrm/Civi/Token/TokenProcessor.php:431 { …}
        /[myserverpath]/public/sites/all/modules/civicrm/Civi/Token/TokenProcessor.php:156 { …}
        /[myserverpath]/public/sites/all/modules/civicrm/CRM/Core/TokenSmarty.php:56 { …}
        /[myserverpath]/public/sites/all/modules/civicrm/CRM/Contact/Form/Edit/CommunicationPreferences.php:95 { …}
        /[myserverpath]/public/sites/all/modules/civicrm/CRM/Contact/Form/Contact.php:804 { …}
        /[myserverpath]/public/sites/all/modules/civicrm/CRM/Core/Form.php:689 { …}
        /[myserverpath]/public/sites/all/modules/civicrm/CRM/Core/QuickForm/Action/Display.php:76 { …}
        /[myserverpath]/public/sites/all/modules/civicrm/packages/HTML/QuickForm/Controller.php:203 { …}
        /[myserverpath]/public/sites/all/modules/civicrm/packages/HTML/QuickForm/Page.php:103 { …}
        /[myserverpath]/public/sites/all/modules/civicrm/CRM/Core/Controller.php:355 { …}
        /[myserverpath]/public/sites/all/modules/civicrm/CRM/Utils/Wrapper.php:98 { …}
        /[myserverpath]/public/sites/all/modules/civicrm/CRM/Core/Invoke.php:292 { …}
        /[myserverpath]/public/sites/all/modules/civicrm/CRM/Core/Invoke.php:69 { …}
        /[myserverpath]/public/sites/all/modules/civicrm/CRM/Core/Invoke.php:36 { …}
        /[myserverpath]/public/sites/all/modules/civicrm/drupal/civicrm.module:471 { …}
        /[myserverpath]/public/includes/menu.inc:527 { …}
        /[myserverpath]/public/index.php:21 { …}
      }
    }
  ]
  
  
  Mar 24 07:14:13  [debug] $backTrace = #0 /[myserverpath]/public/sites/all/modules/civicrm/CRM/Core/Error.php(433): CRM_Core_Error::backtrace(&quot;backTrace&quot;, TRUE)
  #1 /[myserverpath]/public/sites/all/modules/civicrm/CRM/Core/Invoke.php(39): CRM_Core_Error::handleUnhandledException(Object(CRM_Core_Exception))
  #2 /[myserverpath]/public/sites/all/modules/civicrm/drupal/civicrm.module(471): CRM_Core_Invoke::invoke((Array:3))
  #3 /[myserverpath]/public/includes/menu.inc(527): civicrm_invoke(&quot;contact&quot;, &quot;add&quot;)
  #4 /[myserverpath]/public/index.php(21): menu_execute_active_handler()
  #5 {main}
  </code></pre>
  <p>Thanks,
  Steve</p>
  
Tags: <contacts><error><tokens>
Title: Error when editing any contact: Malformed token parameters ({contact.first_name|truncate:1:"":true})
ThreadText: # Error when editing any contact: Malformed token parameters ({contact.first_name|truncate:1:"":true})
  
  (Asked by: username_0 on 2022-03-24)
  
  Running latest CiviCRM on latest Drupal 7, php 7.4.28. This error was reported by one of our volunteers when trying to edit a contact yesterday. Logged in as Admin I can replicate on any contact, and have confirmed that our testing version of the site does exactly the same.
  Having checked recent records added to the contacts table, disabled all extensions, cleared caches, etc. the problem does not go away. I've rolled back to 5.47.0, which was the previous version we were running and it is on there too, so I'm not sure when this issue first appeared (small organisation and it is very possible that this was simply not noticed by our volunteers - I don't regularly use the system myself except to change settings.)
  I'm also seeing the same message in an alert from time to time, for example I just got it when loading the Dashboard.
  Enabling debugging and backtrace, then looking in the logs, I get this, but am unclear what it is telling me or where to go next [server path redacted]. Any suggestions?
  Mar 24 07:14:13  [error] 
  $Fatal Error Details = array:3 [
    "message" => "Malformed token parameters ({contact.first_name|truncate:1:"":true})"
    "code" => null
    "exception" => CRM_Core_Exception {#1862
      -errorData: array:1 [
        "error_code" => 0
      ]
      #cause: null
      -_trace: null
      #message: "Malformed token parameters ({contact.first_name|truncate:1:"":true})"
      #code: 0
      #file: "/[myserverpath]/public/sites/all/modules/civicrm/Civi/Token/TokenProcessor.php"
      #line: 444
      trace: {
        /[myserverpath]/public/sites/all/modules/civicrm/Civi/Token/TokenProcessor.php:444 {
          › if ($unmatched) {
          ›   throw new \CRM_Core_Exception('Malformed token parameters (' . $m[0] . ')');
          › }
        }
        Civi\Token\TokenProcessor->Civi\Token\{closure}() {}
        /[myserverpath]/public/sites/all/modules/civicrm/Civi/Token/TokenProcessor.php:431 { …}
        /[myserverpath]/public/sites/all/modules/civicrm/Civi/Token/TokenProcessor.php:156 { …}
        /[myserverpath]/public/sites/all/modules/civicrm/CRM/Core/TokenSmarty.php:56 { …}
        /[myserverpath]/public/sites/all/modules/civicrm/CRM/Contact/Form/Edit/CommunicationPreferences.php:95 { …}
        /[myserverpath]/public/sites/all/modules/civicrm/CRM/Contact/Form/Contact.php:804 { …}
        /[myserverpath]/public/sites/all/modules/civicrm/CRM/Core/Form.php:689 { …}
        /[myserverpath]/public/sites/all/modules/civicrm/CRM/Core/QuickForm/Action/Display.php:76 { …}
        /[myserverpath]/public/sites/all/modules/civicrm/packages/HTML/QuickForm/Controller.php:203 { …}
        /[myserverpath]/public/sites/all/modules/civicrm/packages/HTML/QuickForm/Page.php:103 { …}
        /[myserverpath]/public/sites/all/modules/civicrm/CRM/Core/Controller.php:355 { …}
        /[myserverpath]/public/sites/all/modules/civicrm/CRM/Utils/Wrapper.php:98 { …}
        /[myserverpath]/public/sites/all/modules/civicrm/CRM/Core/Invoke.php:292 { …}
        /[myserverpath]/public/sites/all/modules/civicrm/CRM/Core/Invoke.php:69 { …}
        /[myserverpath]/public/sites/all/modules/civicrm/CRM/Core/Invoke.php:36 { …}
        /[myserverpath]/public/sites/all/modules/civicrm/drupal/civicrm.module:471 { …}
        /[myserverpath]/public/includes/menu.inc:527 { …}
        /[myserverpath]/public/index.php:21 { …}
      }
    }
  ]
  
  
  Mar 24 07:14:13  [debug] $backTrace = #0 /[myserverpath]/public/sites/all/modules/civicrm/CRM/Core/Error.php(433): CRM_Core_Error::backtrace("backTrace", TRUE)
  #1 /[myserverpath]/public/sites/all/modules/civicrm/CRM/Core/Invoke.php(39): CRM_Core_Error::handleUnhandledException(Object(CRM_Core_Exception))
  #2 /[myserverpath]/public/sites/all/modules/civicrm/drupal/civicrm.module(471): CRM_Core_Invoke::invoke((Array:3))
  #3 /[myserverpath]/public/includes/menu.inc(527): civicrm_invoke("contact", "add")
  #4 /[myserverpath]/public/index.php(21): menu_execute_active_handler()
  #5 {main}
  
  Thanks,
  Steve
  
  **Tags:** contacts, error, tokens
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2022-03-24. Score: 2 | Accepted answer
  
  Have you customised the greetings or addressee formats? Go to `Administer > Communications > Email Greeting Formats, Postal Greeting Formats, Addressee Formats` and compare your values with those on <https://dmaster.demo.civicrm.org>
  
  > **Comments:**
  > **username_0**: Thanks Aiden - you are right, there was an extra entry in Addressee formats. One place I'd not looked as I knew I'd never changed anything on that screen. Deleted it and all is well again. Wonder how that got there, is there any way for me to find out?  
  > **username_1**: The options are stored in the `civicrm_option_value` table so if you're using extended logging you could see what `log_civicrm_option_value` tells you.  
  > **username_0**: Fascinating - that entry has been in the database since 2015, not long after we set the system up, and never caused a problem before! Goodness knows why it was added, but it was my account that did it, though I have absolutely no recollection of it. Some random bit of advice from somewhere while I was finding my feet. Thanks again  
  
  ---
  
  