Could not retrieve data definition for field / Column 'server_id' cannot be null

Created on 20 July 2016, over 8 years ago
Updated 5 September 2023, over 1 year ago

We've updated to:

  • Drupal core 8.1.7
  • search_api 8.1.0-alpha16
  • search_api_solr 8.1.0-alpha5
  • search_api_attachments 8.1.0-alpha4

Afterwards we got the error "Undefined index", because of the missing bundle settings in each index. After we added the config again, we got the error:
Drupal\search_api\SearchApiException: Could not retrieve data definition for field 'Item language' on index 'Content'. in Drupal\search_api\Item\Field->getDataDefinition() (line 400 of modules/contrib/search_api/src/Item/Field.php).

We removed the field 'Item language' via the yml-file (See: https://www.drupal.org/node/2735325#comment-11284917 ), but we got the same error for a lot of other fields. As things turned out for all fields with a dependency.

After removing all this fields two other errors occurred:
Drupal\Core\Entity\EntityStorageException: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'server_id' cannot be null: INSERT INTO {search_api_task} (type, server_id, index_id, data) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3); Array ( [:db_insert_placeholder_0] => trackItems [:db_insert_placeholder_1] => [:db_insert_placeholder_2] => content [:db_insert_placeholder_3] => a:2:{s:10:"datasource";s:11:"entity:node";s:4:"page";i:0;} ) in Drupal\Core\Entity\Sql\SqlContentEntityStorage->save() (line 756 of core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).
Maybe see also: https://www.drupal.org/node/2766827

Notice: Undefined index: view_mode in Drupal\search_api\Plugin\search_api\processor\RenderedItem->calculateDependencies() (line 228 of modules/contrib/search_api/src/Plugin/search_api/processor/RenderedItem.php).
Drupal\search_api\Plugin\search_api\processor\RenderedItem->calculateDependencies() (Line: 1653)

...and we couldn't index items, because the button was disabled. (search status 0/0)

The only solution was to remove all indexes and the server and to re-install all Search-API modules. Then we had to create all indexes and search views again.

🐛 Bug report
Status

Closed: cannot reproduce

Version

1.0

Component

Framework

Created by

🇨🇭Switzerland marco-s Switzerland🇨🇭

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇳🇱Netherlands Martijn Houtman

    I know this is a very old ticket, but I ran into this message this week, and found out it was due to a field that was added to the index, while the bundle that the field belongs to was excluded from being indexed. I think this happened to us due to a faulty git merge, but I think it might also happen if you add the field first, and then after exclude the bundle that the field belongs to. Saving the field list again will remove the field, as it should, but as long as you do not re-save the field list, the error seems to pop up.

Production build 0.71.5 2024