Error on indexing when field has name "from" and "to"

Created on 28 March 2022, over 2 years ago
Updated 1 November 2023, 8 months ago

Problem/Motivation

Error on indexing if field has name "from" end "to".

Steps to reproduce

Add fields with MACHINE NAME
"from" "from_1"
"to" "to_1"
and type of integer.
Start indexing.
Errors:

Drupal\search_api\SearchApiException: SQLSTATE[42S21]: Column already exists: 1060 Duplicate column name 'from': ALTER TABLE "search_api_db_db_index" ADD `from` BIGINT DEFAULT NULL COMMENT 'The field\'s value for this item'; Array ( ) in Drupal\search_api_db\Plugin\search_api\backend\Database->fieldsUpdated() (line 1130 of /modules/contrib/search_api/modules/search_api_db/src/Plugin/search_api/backend/Database.php).


Drupal\search_api\SearchApiException while trying to index items on index DB Index: Could not index items on index 'DB Index' because pending server tasks could not be executed. in Drupal\search_api\Entity\Server->indexItems() (line 353 of /modules/contrib/search_api/src/Entity/Server.php)

If I rename fields to "field_from", "field_to", etc - indexing is ok.

πŸ› Bug report
Status

Postponed: needs info

Version

1.23

Component

Database backend

Created by

πŸ‡·πŸ‡ΊRussia VVS Russia

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.

  • πŸ‡¦πŸ‡ΉAustria drunken monkey Vienna, Austria

    I agree, more details are definitely needed. For instance, which database are you using?

  • πŸ‡·πŸ‡ΊRussia VVS Russia

    @drunken monkey MariaDB

  • πŸ‡¦πŸ‡ΉAustria drunken monkey Vienna, Austria

    Sorry, I could not reproduce the problem, and I’m also always using MariaDB.
    Are you able to reproduce the problem on a fresh installation, only using Core modules and the Search API?

  • πŸ‡ΊπŸ‡ΈUnited States kwiechmann

    Have seen this error at least once while working on reducing technical debt -- many moving parts. Unfortunately, I have not been able to reproduce it yet.

    My environment:

    1. Drupal Core 10.1.4
    2. PHP 8.2.11
    3. MySQL 5.7.42-log
    4. drupal/search_api 8.x-1.29
    5. drupal/search_api_solr 4.2.12
    6. drupal/search_api_solr_legacy 4.2.12



    Error message:

    User error: "cache" is an invalid render array key in Drupal\Core\Render\Element::children() (line 98 of C:\xampp\htdocs\cia-drupal\docroot\core\lib\Drupal\Core\Render\Element.php)
    ```
    #0 C:\xampp\htdocs\cia-drupal\docroot\core\includes\bootstrap.inc(164): _drupal_error_handler_real(256, '"cache" is an i...', 'C:\\xampp\\htdocs...', 98)
    #1 [internal function]: _drupal_error_handler(256, '"cache" is an i...', 'C:\\xampp\\htdocs...', 98)
    #2 C:\xampp\htdocs\cia-drupal\docroot\core\lib\Drupal\Core\Render\Element.php(98): trigger_error('"cache" is an i...', 256)
    #3 C:\xampp\htdocs\cia-drupal\docroot\core\lib\Drupal\Core\Render\Renderer.php(416): Drupal\Core\Render\Element::children(Array, false)
    #4 C:\xampp\htdocs\cia-drupal\docroot\core\lib\Drupal\Core\Render\Renderer.php(458): Drupal\Core\Render\Renderer->doRender(Array)
    #5 C:\xampp\htdocs\cia-drupal\docroot\core\lib\Drupal\Core\Render\Renderer.php(458): Drupal\Core\Render\Renderer->doRender(Array)
    #6 C:\xampp\htdocs\cia-drupal\docroot\core\lib\Drupal\Core\Render\Renderer.php(458): Drupal\Core\Render\Renderer->doRender(Array)
    #7 C:\xampp\htdocs\cia-drupal\docroot\core\lib\Drupal\Core\Render\Renderer.php(204): Drupal\Core\Render\Renderer->doRender(Array, true)
    #8 C:\xampp\htdocs\cia-drupal\docroot\core\lib\Drupal\Core\Render\Renderer.php(148): Drupal\Core\Render\Renderer->render(Array, true)
    #9 C:\xampp\htdocs\cia-drupal\docroot\core\lib\Drupal\Core\Render\Renderer.php(592): Drupal\Core\Render\Renderer->Drupal\Core\Render\{closure}()
    #10 C:\xampp\htdocs\cia-drupal\docroot\core\lib\Drupal\Core\Render\Renderer.php(147): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
    #11 C:\xampp\htdocs\cia-drupal\docroot\core\lib\Drupal\Core\Render\MainContent\AjaxRenderer.php(66): Drupal\Core\Render\Renderer->renderRoot(Array)
    #12 C:\xampp\htdocs\cia-drupal\docroot\core\lib\Drupal\Core\EventSubscriber\MainContentViewSubscriber.php(90): Drupal\Core\Render\MainContent\AjaxRenderer->renderResponse(Array, Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Routing\CurrentRouteMatch))
    #13 [internal function]: Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object(Symfony\Component\HttpKernel\Event\ViewEvent), 'kernel.view', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher))
    #14 C:\xampp\htdocs\cia-drupal\docroot\core\lib\Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher.php(111): call_user_func(Array, Object(Symfony\Component\HttpKernel\Event\ViewEvent), 'kernel.view', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher))
    #15 C:\xampp\htdocs\cia-drupal\vendor\symfony\http-kernel\HttpKernel.php(187): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object(Symfony\Component\HttpKernel\Event\ViewEvent), 'kernel.view')
    #16 C:\xampp\htdocs\cia-drupal\vendor\symfony\http-kernel\HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
    #17 C:\xampp\htdocs\cia-drupal\docroot\modules\contrib\simple_oauth\src\HttpMiddleware\BasicAuthSwap.php(68): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #18 C:\xampp\htdocs\cia-drupal\docroot\core\lib\Drupal\Core\StackMiddleware\Session.php(58): Drupal\simple_oauth\HttpMiddleware\BasicAuthSwap->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #19 C:\xampp\htdocs\cia-drupal\docroot\core\lib\Drupal\Core\StackMiddleware\KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #20 C:\xampp\htdocs\cia-drupal\docroot\core\modules\page_cache\src\StackMiddleware\PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #21 C:\xampp\htdocs\cia-drupal\docroot\core\modules\page_cache\src\StackMiddleware\PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #22 C:\xampp\htdocs\cia-drupal\vendor\asm89\stack-cors\src\Cors.php(53): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #23 C:\xampp\htdocs\cia-drupal\docroot\core\lib\Drupal\Core\StackMiddleware\ReverseProxyMiddleware.php(48): Asm89\Stack\Cors->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #24 C:\xampp\htdocs\cia-drupal\docroot\core\lib\Drupal\Core\StackMiddleware\NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #25 C:\xampp\htdocs\cia-drupal\docroot\core\lib\Drupal\Core\StackMiddleware\StackedHttpKernel.php(51): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #26 C:\xampp\htdocs\cia-drupal\docroot\core\lib\Drupal\Core\DrupalKernel.php(704): Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #27 C:\xampp\htdocs\cia-drupal\docroot\index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
    #28 {main}
    ```
    
Production build 0.69.0 2024