Answers.Body: <p>I noticed this error today, too. What happened?</p>
  <ol>
  <li>Upgrade Drupal &amp; CiviCRM to newest version</li>
  <li>Deleted everything in /sites/default/files/civicrm/templates_c/</li>
  <li>Cleared Drupal cache</li>
  <li>But forgot to visit <a href="https://yourdomain.tld/civicrm/upgrade.php" rel="nofollow noreferrer">https://yourdomain.tld/civicrm/upgrade.php</a> after all
  these steps.</li>
  </ol>
  <p>Please do a database upgrade (/civicrm/upgrade.php) after you installed new code. I hope this will help you and everybody else with this error message after an upgrade.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-01-12T18:11:35.117Z
Answers.LastActivityDate: 2024-01-12T18:11:35.117Z
Answers.UserDisplayName: wintermoor
Body: <p>Upgrading from 5.27.2 to 5.45.1 on Drupal 9.3.2, used <a href="https://www.drupal.org/project/civicrm_drush" rel="nofollow noreferrer">civicrm_drush</a> module, also tried with UI.</p>
  <p>Getting following Error:</p>
  <p>log file details</p>
  <pre><code>    [info] Running task: Update legacy prefix id token in greetings (use {contact.prefix_id:label})
  
      [info] Civi\API\Exception\NotImplementedException: &quot;API (OptionValue, getFields) does not exist (join the API team and implement it!)&quot;
      #0 PATH/distro9.test/vendor/civicrm/civicrm-core/Civi/Api4/Generic/AbstractAction.php(437): Civi\API\Request::create(&quot;OptionValue&quot;, &quot;getFields&quot;, (Array:4))
      #1 PATH/distro9.test/vendor/civicrm/civicrm-core/Civi/Api4/Generic/AbstractGetAction.php(44): Civi\Api4\Generic\AbstractAction-&gt;entityFields()
      #2 PATH/distro9.test/vendor/civicrm/civicrm-core/Civi/Api4/Generic/DAOGetAction.php(97): Civi\Api4\Generic\AbstractGetAction-&gt;setDefaultWhereClause()
      #3 PATH/distro9.test/vendor/civicrm/civicrm-core/Civi/Api4/Provider/ActionObjectProvider.php(68): Civi\Api4\Generic\DAOGetAction-&gt;_run(Object(Civi\Api4\Generic\Result))
      #4 PATH/distro9.test/vendor/civicrm/civicrm-core/Civi/API/Kernel.php(149): Civi\Api4\Provider\ActionObjectProvider-&gt;invoke(Object(Civi\Api4\Generic\DAOGetAction))
      #5 PATH/distro9.test/vendor/civicrm/civicrm-core/Civi/Api4/Generic/AbstractAction.php(234): Civi\API\Kernel-&gt;runRequest(Object(Civi\Api4\Generic\DAOGetAction))
      #6 PATH/distro9.test/vendor/civicrm/civicrm-core/CRM/Upgrade/Incremental/MessageTemplates.php(420): Civi\Api4\Generic\AbstractAction-&gt;execute()
      #7 PATH/distro9.test/vendor/civicrm/civicrm-core/CRM/Upgrade/Incremental/Base.php(320): CRM_Upgrade_Incremental_MessageTemplates-&gt;replaceTokenInGreetingOptions(&quot;contact.prefix_id&quot;, &quot;contact.prefix_id:label&quot;)
      #8 PATH/distro9.test/vendor/civicrm/civicrm-core/CRM/Queue/Task.php(74): CRM_Upgrade_Incremental_Base::updateGreetingOptions(Object(CRM_Queue_TaskContext), &quot;contact.prefix_id&quot;, &quot;contact.prefix_id:label&quot;, &quot;5.43.alpha1&quot;)
      #9 PATH/distro9.test/vendor/civicrm/civicrm-core/CRM/Queue/Runner.php(201): CRM_Queue_Task-&gt;run(Object(CRM_Queue_TaskContext))
      #10 PATH/distro9.test/vendor/civicrm/civicrm-core/CRM/Queue/Runner.php(155): CRM_Queue_Runner-&gt;runNext()
      #11 PATH/distro9.test/vendor/civicrm/civicrm-core/CRM/Upgrade/Headless.php(49): CRM_Queue_Runner-&gt;runAll()
      #12 PATH/distro9.test/web/modules/contrib/civicrm_drush/src/Commands/CivicrmDrushCommands.php(435): CRM_Upgrade_Headless-&gt;run()
      #13 [internal function](): Drupal\civicrm_drush\Commands\CivicrmDrushCommands-&gt;drushCivicrmUpgradeDb((Array:20))
      #14 PATH/distro9.test/vendor/consolidation/annotated-command/src/CommandProcessor.php(257): call_user_func_array((Array:2), (Array:1))
      #15 PATH/distro9.test/vendor/consolidation/annotated-command/src/CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor-&gt;runCommandCallback((Array:2), Object(Consolidation\AnnotatedCommand\CommandData))
      #16 PATH/distro9.test/vendor/consolidation/annotated-command/src/CommandProcessor.php(176): Consolidation\AnnotatedCommand\CommandProcessor-&gt;validateRunAndAlter((Array:3), (Array:2), Object(Consolidation\AnnotatedCommand\CommandData))
      #17 PATH/distro9.test/vendor/consolidation/annotated-command/src/AnnotatedCommand.php(350): Consolidation\AnnotatedCommand\CommandProcessor-&gt;process(Object(Symfony\Component\Console\Output\ConsoleOutput), (Array:3), (Array:2), Object(Consolidation\AnnotatedCommand\CommandData))
      #18 PATH/distro9.test/vendor/symfony/console/Command/Command.php(255): Consolidation\AnnotatedCommand\AnnotatedCommand-&gt;execute(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
      #19 PATH/distro9.test/vendor/symfony/console/Application.php(1027): Symfony\Component\Console\Command\Command-&gt;run(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
      #20 PATH/distro9.test/vendor/symfony/console/Application.php(273): Symfony\Component\Console\Application-&gt;doRunCommand(Object(Consolidation\AnnotatedCommand\AnnotatedCommand), Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
      #21 PATH/distro9.test/vendor/symfony/console/Application.php(149): Symfony\Component\Console\Application-&gt;doRun(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
  </code></pre>
  <p>same issue with dashboard, look like its related <code>getFields</code> action.</p>
  <hr />
  <p>i thought, lets try upto <code>5.41.2</code>, Upgrade went smooth using drush.</p>
  <p>While loading civicrm, i am getting <code>Authorization failed</code> error. (mostly on dashboard, api4 with permission check).</p>
  <pre><code>    $Fatal Error Details = array:3 [
        &quot;message&quot; =&gt; &quot;Authorization failed&quot;
        &quot;code&quot; =&gt; null
        &quot;exception&quot; =&gt; Civi\API\Exception\UnauthorizedException {#3157
          -extraParams: array:1 [
            &quot;error_code&quot; =&gt; &quot;unauthorized&quot;
          ]
          #message: &quot;Authorization failed&quot;
          #code: 0
          #file: &quot;PATH/distro9.test/vendor/civicrm/civicrm-core/Civi/API/Kernel.php&quot;
          #line: 223
          trace: {
            PATH/distro9.test/vendor/civicrm/civicrm-core/Civi/API/Kernel.php:223 { …}
            PATH/distro9.test/vendor/civicrm/civicrm-core/Civi/API/Kernel.php:147 { …}
            PATH/distro9.test/vendor/civicrm/civicrm-core/Civi/Api4/Generic/AbstractAction.php:234 { …}
            PATH/distro9.test/vendor/civicrm/civicrm-core/api/api.php:85 { …}
            PATH/distro9.test/vendor/civicrm/civicrm-core/CRM/Core/BAO/Dashboard.php:69 { …}
            PATH/distro9.test/vendor/civicrm/civicrm-core/CRM/Contact/Page/DashBoard.php:52 { …}
            PATH/distro9.test/vendor/civicrm/civicrm-core/CRM/Core/Invoke.php:313 { …}
            PATH/distro9.test/vendor/civicrm/civicrm-core/CRM/Core/Invoke.php:69 { …}
            PATH/distro9.test/vendor/civicrm/civicrm-core/CRM/Core/Invoke.php:36 { …}
            PATH/distro9.test/web/modules/contrib/civicrm/src/Civicrm.php:88 {
              Drupal\civicrm\Civicrm-&gt;invoke($args)
              › ob_start();
              › $content = \CRM_Core_Invoke::invoke($args);
              › $output = ob_get_clean();
              arguments: {
                $args: array:1 [ …1]
              }
            }
  </code></pre>
  <p>e.g.  Membership Tab</p>
  <pre><code>$membershipTypes = \Civi\Api4\MembershipType::get(TRUE)
        -&gt;execute()
        -&gt;indexBy('id')
        -&gt;column('name');
  </code></pre>
  <p>Logged in user have 'administrator` role, and all permission of civicrm are checked.</p>
  <p>Also how does <code>https://distro9.test/civicrm/placeholder-url-path?civicrm-placeholder-url-query=1</code> url get resolved ? i did not see any class mapping.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-01-16T15:10:22.773Z
Comments.Text: For the very last part, the placeholder-url gets replaced in js/crm.ajax.js. For the first error, that's really strange because EVERY api4 entity has to have a getFields function. Api4 used to be a separate extension - does that site have the old extension installed? In any case it would be better if upgrade steps (i.e. replaceTokenInGreetingOptions()) [didn't use api calls](https://docs.civicrm.org/dev/en/latest/framework/upgrade/#tips-prefer-simple-sql-semantics-over-apibaodao) to avoid this type of thing. That should be improved in that core function I think.
Comments.UserDisplayName: Demerit
Tags: <upgrade><permissions>
Title: Upgrading to 5.45.1 get error
ThreadText: # Upgrading to 5.45.1 get error
  
  (Asked by: username_0 on 2022-01-16)
  
  Upgrading from 5.27.2 to 5.45.1 on Drupal 9.3.2, used civicrm_drush module, also tried with UI.
  Getting following Error:
  log file details
      [info] Running task: Update legacy prefix id token in greetings (use {contact.prefix_id:label})
  
      [info] Civi\API\Exception\NotImplementedException: "API (OptionValue, getFields) does not exist (join the API team and implement it!)"
      #0 PATH/distro9.test/vendor/civicrm/civicrm-core/Civi/Api4/Generic/AbstractAction.php(437): Civi\API\Request::create("OptionValue", "getFields", (Array:4))
      #1 PATH/distro9.test/vendor/civicrm/civicrm-core/Civi/Api4/Generic/AbstractGetAction.php(44): Civi\Api4\Generic\AbstractAction->entityFields()
      #2 PATH/distro9.test/vendor/civicrm/civicrm-core/Civi/Api4/Generic/DAOGetAction.php(97): Civi\Api4\Generic\AbstractGetAction->setDefaultWhereClause()
      #3 PATH/distro9.test/vendor/civicrm/civicrm-core/Civi/Api4/Provider/ActionObjectProvider.php(68): Civi\Api4\Generic\DAOGetAction->_run(Object(Civi\Api4\Generic\Result))
      #4 PATH/distro9.test/vendor/civicrm/civicrm-core/Civi/API/Kernel.php(149): Civi\Api4\Provider\ActionObjectProvider->invoke(Object(Civi\Api4\Generic\DAOGetAction))
      #5 PATH/distro9.test/vendor/civicrm/civicrm-core/Civi/Api4/Generic/AbstractAction.php(234): Civi\API\Kernel->runRequest(Object(Civi\Api4\Generic\DAOGetAction))
      #6 PATH/distro9.test/vendor/civicrm/civicrm-core/CRM/Upgrade/Incremental/MessageTemplates.php(420): Civi\Api4\Generic\AbstractAction->execute()
      #7 PATH/distro9.test/vendor/civicrm/civicrm-core/CRM/Upgrade/Incremental/Base.php(320): CRM_Upgrade_Incremental_MessageTemplates->replaceTokenInGreetingOptions("contact.prefix_id", "contact.prefix_id:label")
      #8 PATH/distro9.test/vendor/civicrm/civicrm-core/CRM/Queue/Task.php(74): CRM_Upgrade_Incremental_Base::updateGreetingOptions(Object(CRM_Queue_TaskContext), "contact.prefix_id", "contact.prefix_id:label", "5.43.alpha1")
      #9 PATH/distro9.test/vendor/civicrm/civicrm-core/CRM/Queue/Runner.php(201): CRM_Queue_Task->run(Object(CRM_Queue_TaskContext))
      #10 PATH/distro9.test/vendor/civicrm/civicrm-core/CRM/Queue/Runner.php(155): CRM_Queue_Runner->runNext()
      #11 PATH/distro9.test/vendor/civicrm/civicrm-core/CRM/Upgrade/Headless.php(49): CRM_Queue_Runner->runAll()
      #12 PATH/distro9.test/web/modules/contrib/civicrm_drush/src/Commands/CivicrmDrushCommands.php(435): CRM_Upgrade_Headless->run()
      #13 [internal function](): Drupal\civicrm_drush\Commands\CivicrmDrushCommands->drushCivicrmUpgradeDb((Array:20))
      #14 PATH/distro9.test/vendor/consolidation/annotated-command/src/CommandProcessor.php(257): call_user_func_array((Array:2), (Array:1))
      #15 PATH/distro9.test/vendor/consolidation/annotated-command/src/CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback((Array:2), Object(Consolidation\AnnotatedCommand\CommandData))
      #16 PATH/distro9.test/vendor/consolidation/annotated-command/src/CommandProcessor.php(176): Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter((Array:3), (Array:2), Object(Consolidation\AnnotatedCommand\CommandData))
      #17 PATH/distro9.test/vendor/consolidation/annotated-command/src/AnnotatedCommand.php(350): Consolidation\AnnotatedCommand\CommandProcessor->process(Object(Symfony\Component\Console\Output\ConsoleOutput), (Array:3), (Array:2), Object(Consolidation\AnnotatedCommand\CommandData))
      #18 PATH/distro9.test/vendor/symfony/console/Command/Command.php(255): Consolidation\AnnotatedCommand\AnnotatedCommand->execute(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
      #19 PATH/distro9.test/vendor/symfony/console/Application.php(1027): Symfony\Component\Console\Command\Command->run(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
      #20 PATH/distro9.test/vendor/symfony/console/Application.php(273): Symfony\Component\Console\Application->doRunCommand(Object(Consolidation\AnnotatedCommand\AnnotatedCommand), Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
      #21 PATH/distro9.test/vendor/symfony/console/Application.php(149): Symfony\Component\Console\Application->doRun(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
  
  same issue with dashboard, look like its related getFields action.
  
  i thought, lets try upto 5.41.2, Upgrade went smooth using drush.
  While loading civicrm, i am getting Authorization failed error. (mostly on dashboard, api4 with permission check).
      $Fatal Error Details = array:3 [
        "message" => "Authorization failed"
        "code" => null
        "exception" => Civi\API\Exception\UnauthorizedException {#3157
          -extraParams: array:1 [
            "error_code" => "unauthorized"
          ]
          #message: "Authorization failed"
          #code: 0
          #file: "PATH/distro9.test/vendor/civicrm/civicrm-core/Civi/API/Kernel.php"
          #line: 223
          trace: {
            PATH/distro9.test/vendor/civicrm/civicrm-core/Civi/API/Kernel.php:223 { …}
            PATH/distro9.test/vendor/civicrm/civicrm-core/Civi/API/Kernel.php:147 { …}
            PATH/distro9.test/vendor/civicrm/civicrm-core/Civi/Api4/Generic/AbstractAction.php:234 { …}
            PATH/distro9.test/vendor/civicrm/civicrm-core/api/api.php:85 { …}
            PATH/distro9.test/vendor/civicrm/civicrm-core/CRM/Core/BAO/Dashboard.php:69 { …}
            PATH/distro9.test/vendor/civicrm/civicrm-core/CRM/Contact/Page/DashBoard.php:52 { …}
            PATH/distro9.test/vendor/civicrm/civicrm-core/CRM/Core/Invoke.php:313 { …}
            PATH/distro9.test/vendor/civicrm/civicrm-core/CRM/Core/Invoke.php:69 { …}
            PATH/distro9.test/vendor/civicrm/civicrm-core/CRM/Core/Invoke.php:36 { …}
            PATH/distro9.test/web/modules/contrib/civicrm/src/Civicrm.php:88 {
              Drupal\civicrm\Civicrm->invoke($args)
              › ob_start();
              › $content = \CRM_Core_Invoke::invoke($args);
              › $output = ob_get_clean();
              arguments: {
                $args: array:1 [ …1]
              }
            }
  
  e.g.  Membership Tab
  $membershipTypes = \Civi\Api4\MembershipType::get(TRUE)
        ->execute()
        ->indexBy('id')
        ->column('name');
  
  Logged in user have 'administrator` role, and all permission of civicrm are checked.
  Also how does https://distro9.test/civicrm/placeholder-url-path?civicrm-placeholder-url-query=1 url get resolved ? i did not see any class mapping.
  
  **Tags:** upgrade, permissions
  
  > **Comments:**
  > **username_1**: For the very last part, the placeholder-url gets replaced in js/crm.ajax.js. For the first error, that's really strange because EVERY api4 entity has to have a getFields function. Api4 used to be a separate extension - does that site have the old extension installed? In any case it would be better if upgrade steps (i.e. replaceTokenInGreetingOptions()) [didn't use api calls](https://docs.civicrm.org/dev/en/latest/framework/upgrade/#tips-prefer-simple-sql-semantics-over-apibaodao) to avoid this type of thing. That should be improved in that core function I think.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2024-01-12. Score: 0
  
  I noticed this error today, too. What happened?
  
  1. Upgrade Drupal & CiviCRM to newest version
  2. Deleted everything in /sites/default/files/civicrm/templates\_c/
  3. Cleared Drupal cache
  4. But forgot to visit <https://yourdomain.tld/civicrm/upgrade.php> after all
     these steps.
  
  Please do a database upgrade (/civicrm/upgrade.php) after you installed new code. I hope this will help you and everybody else with this error message after an upgrade.
  
  
  ---
  
  