On the latest version of Craft, (3.7.25.1) after updating I'm getting regular errors when importing a backup into production servers during deployments. Here is an example of the error:
error: The shell command "mysql --defaults-extra-file="/tmp/ewpqcugdwoke.cnf" craft3 < "/var/www/craft3/mysql_backups/backup.sql"" failed with exit code 1: ERROR 1062 (23000) at line 5894: Duplicate entry '2da4a0e' for key 'PRIMARY'
When I search for the entry reported in the error, in this case: '2da4a0e', I'll always find the string in the SQL file INSERT INTO craft_resourcepaths
VALUES ... section. There is never a duplicate in the sql file so why am I seeing these errors and how can this be fixed?
Example of the import command:
php craft db/restore /var/www/craft3/mysql_backups/backup.sql --interactive=0
If I manually import the db it works. For example:
sudo mysql craft3 < mysql_backups/backup.sql