I found my Drupal8 website broken with no appearent reason, i.e., no code nor structure modifications since it was working last time.
I discovered that the error was initially raised after a Rest PostSymfony\Component\HttpKernel\Exception\HttpException: Internal Server Error in Drupal\rest\Plugin\rest\resource\EntityResource->post() (line 200 of /var/www/elders.dev/core/modules/rest/src/Plugin/rest/resource/EntityResource.php).
After some testing I discovered the problem is from the query creating the entity,<strong>Drupal\Core\Database\IntegrityConstraintViolationException</strong>: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '179-0-0-en' for key 'PRIMARY': INSERT INTO {node__field_device_id} (entity_id, revision_id, bundle, delta, langcode, field_device_id_value) 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] => 179 [:db_insert_placeholder_1] => 191 [:db_insert_placeholder_2] => accesso [:db_insert_placeholder_3] => 0 [:db_insert_placeholder_4] => en [:db_insert_placeholder_5] => ID TEST ) in Drupal\Core\Database\Connection->handleQueryException() (line 682 of /var/www/elders.dev/core/lib/Drupal/Core/Database/Connection.php).
and<strong>Drupal\Core\Entity\EntityStorageException: SQLSTATE[23000]: Integrity constraint violation:</strong> 1062 Duplicate entry '179-0-0-en' for key 'PRIMARY': INSERT INTO {node__field_device_id} (entity_id, revision_id, bundle, delta, langcode, field_device_id_value) 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] => 179 [:db_insert_placeholder_1] => 191 [:db_insert_placeholder_2] => accesso [:db_insert_placeholder_3] => 0 [:db_insert_placeholder_4] => en [:db_insert_placeholder_5] => ID TEST ) in Drupal\Core\Entity\Sql\SqlContentEntityStorage->save() (line 777 of /var/www/elders.dev/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).
Now I can't create nodes that share those fields anymore, I get the white page:
The website encountered an unexpected error. Please try again later.
This issue doesn't seem to be striclty related to: