warning with variable %field_label has no value or fallback

Created on 16 October 2023, about 1 year ago
Updated 23 October 2023, about 1 year ago

Problem/Motivation

Steps to reproduce

Today I got this (Drupal 10.1.5 Search Api 8.x-1.30):

I install theme (for new node type), install module (with content for node type):
Now this is correct:
[warning] The field Rendered item (rendered_item) on index Default content index is missing view mode configuration for some datasources or bundles. Please review (and re-save) the field settings.

Then I do:
drush cex, drush cim, drush cr (workflow see https://www.drupal.org/project/search_api/issues/3393946 🐛 Highlight excerpts in frontend only works with twig files with an initial activation of option excerpt_always Closed: works as designed )

 [success] Configuration successfully exported to sites/default/files/config_sync.
sites/default/files/config_sync
 [notice] There are no changes to import.
 [warning] The field %field_label (rendered_item) on index Default content index is missing view mode configuration for some datasources or bundles. Please review (and re-save) the field settings.
 [success] Cache rebuild complete.

Proposed resolution

The string with %field_label was not solved with a value. Maybe no fallback?

🐛 Bug report
Status

Postponed: needs info

Version

1.30

Component

General code

Created by

🇩🇪Germany thomaswalther Rhein-Main Area

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @thomaswalther
  • Status changed to Postponed: needs info about 1 year ago
  • 🇦🇹Austria drunken monkey Vienna, Austria

    I’m sorry, but this problem is utterly inexplicable to me, and I also cannot reproduce it.
    In the line in question in \Drupal\search_api\Plugin\search_api\processor\RenderedItem::addFieldValues(), the %field_label substitution variable definitely has a value assigned, no way around it. And if it works for the other variables (also with % prefix), then why wouldn’t it for this one? Even if the value is an empty string or null, it should be replaced.
    Furthermore, why would exporting and re-importing your config even remove the field label, if it was present before?

    Again, I’m sorry, but I really don’t know how to help you here. Can you yourself reproduce the problem? If so, maybe start by checking the value of $context when the warning is logged. And check the config export whether the rendered_item field does or doesn’t have a label set.
    But it’s of course also a rather minor problem, so we might as well just wait and see whether others run into this problem, too.

Production build 0.71.5 2024