Solve error: SQLSTATE[22001]: String data, right truncated: 1406 Data too long

Created on 20 April 2025, 5 days ago

Problem/Motivation

when adding many fields to add to the download_fields field the following error is generated:

The website encountered an unexpected error. Try again later.

Drupal\Core\Entity\EntityStorageException: SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'field_codigo_postal_download_fields' at row 1: INSERT INTO "node__field_codigo_postal_download_fields" ("bundle", "deleted", "langcode", "field_codigo_postal_download_fields", "field_codigo_postal_download_label") VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5); Array ([:db_insert_placeholder_0] => 1 [:db_insert_placeholder_1] => 0 [:db_insert_placeholder_2] => page [:db_insert_placeholder_3] => field_image0":s:13:"field_image0";s:15:"field_archive0";s:14:"field_archive0";s:14:"field_archive1";s:14:"field_archive1";s:14:"field_archive2";s:14:"field_archive2";s:14:"field_archive3";s:14:"field_archive3";s:14:"field_archive4";s:14:"field_archive4";s:14:"field_archive5";s:14:"field_archive5"; [:db_insert_placeholder_4] => a:19: [:db_insert_placeholder_5] => 14:) in Drupal\Core\Entity\Sql\SqlContentEntityStorage->save() (line 816 of core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).

Drupal\Core\Database\StatementWrapperIterator->execute() (Line: 334)

Drupal\mysql\Driver\Database\mysql\Insert->execute() (Line: 1395)

Drupal\Core\Entity\Sql\SqlContentEntityStorage->saveToDedicatedTables() (Line: 968)

Drupal\Core\Entity\Sql\SqlContentEntityStorage->doSaveFieldItems() (Line: 718)

Drupal\Core\Entity\ContentEntityStorageBase->doSave() (Line: 486)

Drupal\Core\Entity\EntityStorageBase->save() (Line: 805)

Drupal\Core\Entity\ContentEntityStorageBase->save() (Line: 354)

Drupal\node\NodeForm->save() (Line: 261)

call_user_func_array() (Line: 165)

Drupal\Core\Form\FormSubmitter->doSubmitForm() (Line: 443)

Drupal\Core\Form\FormSubmitter->processForm() (Line: 321)

Drupal\Core\Form\FormBuilder->buildForm() (Line: 73)

Drupal\Core\Controller\FormController->getContentResult()

call_user_func_array() (Line: 123)

Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 593)

Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 121)

Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() (Line: 97)

Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 183)

Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 76)

Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 53)

Drupal\Core\StackMiddleware\Session->handle() (Line: 48)

Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 28)

Drupal\big_pipe\StackMiddleware\ContentLength->handle() (Line: 32)

Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 106)

Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 48)

Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)

Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 36)

Drupal\Core\StackMiddleware\AjaxPageState->handle() (Line: 51)

Drupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 704)

Drupal\Core\DrupalKernel->handle() (Line: 19)

Steps to reproduce

Add many image type fields in a node and create a Download Link type field with these image type fields

πŸ“Œ Task
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΎUruguay apereira23

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024