Resolution

If you have only have one website, then the second test for the websites doesn’t apply, and you only need to test for stores.

To solve this issue, identify the invalid rows left from those configurations.

  1. SSH to the server and run this command:

    bin/magento
    
  2. The error message may indicate what rows and tables remain in the database from deleted sites. For example, the following is an error indicating that the requested store wasn’t found:

    ...
        In StoreRepository.php line 112:
    
        The store that was requested wasn't found. Verify the store and try again.
    
  3. Run this MySQL query to verify that the store cannot be found, which is indicated by the error message in step 2.

    select distinct scope_id from core_config_data where scope='stores' and scope_id not in (select store_id from store);
    
  4. Run the following MySQL statement to delete the invalid rows:

    delete from core_config_data where scope='stores' and scope_id not in (select store_id from store);
    
  5. Run this command again:

    bin/magento
    

    If you get an error like the one below which indicates that the website with id X that was requested wasn’t found, you have configurations remaining in the database from website(s), as well as store(s), that have been deleted.

    In WebsiteRepository.php line 110:
    
        The website with id X that was requested wasn't found. Verify the website and try again.
    

    Run this MySQL query and verify that the website can’t be found:

    select distinct scope_id from core_config_data where scope='websites' and scope_id not in (select website_id from store_website);
    
  6. Run this MySQL statement to delete the invalid rows from the website configuration:

    delete from core_config_data where scope='websites' and scope_id not in (select website_id from store_website);
    
3d58f420-19b5-47a0-a122-5c9dab55ec7f

Connect with Experience League at Summit!

Get front-row access to top sessions, hands-on activities, and networking—wherever you are!

Learn more