Magento2: Integrity constraint violation: 1062 Duplicate entry 'default-0-system/full_page_cache/varnish/access_list'

Created on 16 Jan 2018  路  10Comments  路  Source: magento/magento2


Preconditions


  1. Install V2.2.2

Steps to reproduce

  1. Enable developer mode and then maintenance mode and then defaults mode again.
  2. Access the Admin 禄 Stores 禄 Configuration 禄 Advanced 禄System

I don't know the exact step to reproduce the issue, I play with Magento command.

Expected result

  1. It shows system related settings options

Actual result

image

Format is valid needs update

Most helpful comment

Had the same issue on 2.2.4... try re-run setup php bin/magento setup:upgrade

All 10 comments

@sumanta-ghosh Thanks for your report. Please clarify your steps, and exact commands and the order that you used, thank you.

@sumanta-ghosh, we are closing this issue due to inactivity. If you'd like to update it, please reopen the issue.

@magento-engcom-team I' have exact the same issue as sumanta-ghosh reported it on 2.2.2 I've only changed from default to developer mode and when I access

Access the Admin 禄 Stores 禄 Configuration 禄 Advanced 禄System I get the error
I've looked at DB:
SELECT * FROM core_config_data WHERE path LIKE '%varnish%';
+-----------+---------+----------+---------------------------------------------+-----------+
| config_id | scope | scope_id | path | value |
+-----------+---------+----------+---------------------------------------------+-----------+
| 202 | default | 0 | system/full_page_cache/varnish/access_list | localhost |
| 203 | default | 0 | system/full_page_cache/varnish/backend_host | localhost |
| 204 | default | 0 | system/full_page_cache/varnish/backend_port | 8080 |
| 205 | default | 0 | system/full_page_cache/varnish/grace_period | 300 |
+-----------+---------+----------+---------------------------------------------+-----------+
is it trying to insert again when there is one ?

Any Ideas?

Thank you.

@sumanta-ghosh relate issue here: https://github.com/magento/magento2/issues/13055

I have this same issue in Magento 2.2.3.

When I go to the configuration to 'advanced > system', the first time it works, but when I visit it again (or reload the page), the exception is thrown.

Also running in developer mode. As lano-vargas points out: it seems that visiting this tab adds 4 extra rows to the system configuration. If I delete the 4 entries from my database, I can reload the page, but then Magento adds the 4 entries again. Note that I did not click 'save' or something. Just reloading the page seems to add 4 entries to the database. Reloading the page again will throw this error.

Note that I do not have varnish installed in my local development setup. But I also didn't select it as the preferred caching mechanism. So it's odd that a Varnish-related error is thrown without me even using Varnish.

EDIT - Flushed Cache and I can enter the system settings.

Having the same issue on 2.2.4. This was a migrated website and going live in a few weeks. Commenting to follow. This is a dev site and not running Varnish.

4 exception(s):
Exception #0 (Magento\Framework\Exception\AlreadyExistsException): Unique constraint violation found
Exception #1 (Magento\Framework\DB\Adapter\DuplicateException): SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'default-0-system/full_page_cache/varnish/access_list' for key 'CORE_CONFIG_DATA_SCOPE_SCOPE_ID_PATH', query was: INSERT INTO core_config_data (path, value) VALUES (?, ?)
Exception #2 (Zend_Db_Statement_Exception): SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'default-0-system/full_page_cache/varnish/access_list' for key 'CORE_CONFIG_DATA_SCOPE_SCOPE_ID_PATH', query was: INSERT INTO core_config_data (path, value) VALUES (?, ?)
Exception #3 (PDOException): SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'default-0-system/full_page_cache/varnish/access_list' for key 'CORE_CONFIG_DATA_SCOPE_SCOPE_ID_PATH'

Why is this closed? Issue still persistent...
M 2.2.2

Same here with a fresh installation of M2.2.5.
In my case this happens in multi-store setup, when i have different configurations for each store.
The error comes in the "default config", possibly due to the fact that there are duplicate entries for columns that supposed to be unique.

4 exception(s):
Exception #0 (Magento\Framework\Exception\AlreadyExistsException): Unique constraint violation found
Exception #1 (Magento\Framework\DB\Adapter\DuplicateException): SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'default-0-system/full_page_cache/varnish/access_list' for key 'CORE_CONFIG_DATA_SCOPE_SCOPE_ID_PATH', query was: INSERT INTO `core_config_data` (`path`, `value`) VALUES (?, ?)
Exception #2 (Zend_Db_Statement_Exception): SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'default-0-system/full_page_cache/varnish/access_list' for key 'CORE_CONFIG_DATA_SCOPE_SCOPE_ID_PATH', query was: INSERT INTO `core_config_data` (`path`, `value`) VALUES (?, ?)
Exception #3 (PDOException): SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'default-0-system/full_page_cache/varnish/access_list' for key 'CORE_CONFIG_DATA_SCOPE_SCOPE_ID_PATH'

Had the same issue on 2.2.4... try re-run setup php bin/magento setup:upgrade

This issue appears only when you first time go to System section and without saving reload the page.
Its because Magento\PageCache\Model\System\Config\Backend\Varnish in method _afterLoad it saves default values if values wasn't saved before.
https://github.com/magento/magento2/blob/2.3-develop/app/code/Magento/PageCache/Model/System/Config/Backend/Varnish.php#L63
Simple clean cache can resolve this issue.

Was this page helpful?
0 / 5 - 0 ratings