Troubleshooting
CMS Page with the same ID already exists error
4 min
problem after installation of klevu and api key integration, some stores may experience the following error when running sync operations, or saving cms pages item (magento\cms\model\page) with the same id "{id}" already exists cause the root cause of this is an unexpected cms page > store view configuration and how that conflicts with the way klevu collects pages to process klevu will attempt to retrieve all records which belong to either all store views or the specific store being synchronised where a cms page has been redundantly assigned to both all store views and the store view being synced, duplicate records may be picked up by klevu an example of this configuration is below solution update your store's configuration to assign problematic cms pages (the database id is provided in the error message) to be assigned to either all store views or specific stores if you have database access, you can check the cms page store table to find duplicate page id rows where at least one row has a store id of 0 workaround if are unable to resolve the configuration, you can create a small patch for the klevu/module v4 indexing cms module in the klevu\indexingcms\service\provider\cmsentityprovider getpagecollection , look for the modifications made to the $pagecollection database select when a $store value is passed at the end of this block, add the following line $select >group('main table page id'); ref cmsentityprovider @ 3 1 1 on github the block should look like this after (code correct at module v3 1 1) // snip if ($store) { $connection = $pagecollection >getconnection(); $select = $pagecollection >getselect(); $select >joininner( name \['store' => $pagecollection >gettable('cms page store')], cond implode( ' ' select sql and ' ', \[ sprintf( 'main table page id = store %s', $connection >quoteidentifier($linkfield), ), $connection >quoteinto('store store id in (0,?)', (int)$store >getid()), ], ), cols \['store store id'], ); $select >group('main table page id'); } // snip