"Parent Role id ‘G1’ does not exist" error message is displayed on login as admin

"Parent Role id ‘G1’ does not exist" error message is displayed on login as admin

July 27, 2026 · Illustrated author avatarBy Stefan Bogdanescu
"Parent Role id ‘G1’ does not exist" error message is displayed on login as admin

Magento Admin Login Error: “Parent Role id ‘G1’ does not exist”

Are you facing the frustrating message “Parent Role id ‘G1’ does not exist” when trying to log in as an admin user on your Magento backend? Don’t worry, we’ve all been there! This error usually occurs due to a misconfiguration or corruption within your Magento database. Let’s dive into the root causes and step-by-step solutions.

Understanding the Error

The “Parent Role id ‘G1’ does not exist” warning is generated by Magento when it cannot find a specific role record in the core_role table, which is required for an admin user to have permissions. This could happen due to:

  • Manually deleting or altering core tables
  • Incorrect database migrations during updates/upgrades
  • Data corruption from previous hacks or attacks

Step-by-Step Solutions

  1. Check the Database Connection Ensure your Magento installation is properly connected to its database. Log in via SSH and run php bin/magento setup:di:compile to validate the connection.

  2. Inspect the core_role Table Open MySQL or phpMyAdmin, navigate to your Magento database, and query the core_role table:

    SELECT * FROM core_role;
    

    Verify if the role with ID ‘G1’ exists. If it’s missing or corrupted, proceed to step 3.

  3. Repair the core_role Table Use the following SQL command to re-create the core_role table:

    DROP TABLE IF EXISTS `core_role`;
    CREATE TABLE `core_role` (
      `role_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
      `parent_id` int(10) unsigned DEFAULT NULL,
      `tree_level` int(10) unsigned NOT NULL DEFAULT '0',
      PRIMARY KEY (`role_id`)
    );
    ALTER TABLE `core_role`
      ADD UNIQUE (`role_id`);
    ALTER TABLE `core_role`
      MODIFY `parent_id` int(10) unsigned DEFAULT NULL;
    
  4. Reinstall the core_role Data After re-creating the table, run this SQL to reinstall the default roles:

    INSERT INTO `core_role` (`role_id`, `parent_id`) VALUES
      (1, 0),
      (2, 1);
    

    Now you should have the required ‘Admin’ and ‘Guest’ roles in your database.

  5. Clear Magento Cache After completing the database repairs, run these commands to clear all cache:

    php bin/magento cache:clean
    rm -rf var/cache/*
    

Conclusion

The “Parent Role id ‘G1’ does not exist” error is typically a result of database corruption or misconfiguration. By following the steps above, you should be able to resolve this issue and regain access to your Magento admin panel.

Remember, always take regular backups before performing any manual database operations. If you’re unsure about managing your database directly, consider reaching out to LaravelCompany for professional support and maintenance services.

Happy coding!

Database Security Admin Configuration

Our network