Skip to content

Duplicate entry error for email during pseudonymization #1

@tabacha

Description

@tabacha

Hi,
first of all, thank you for this great project – it's incredibly useful!

I'm running into an issue when executing the pseudify:pseudonymize command. During the pseudonymization process, I receive the following error:

pseudify  | {"message":"Executing statement: UPDATE `tblusers` SET `email` = ? WHERE `id` = ? (parameters: array{\"1\":\"nschubert@example.org\",\"2\":70254}, types: array{\"1\":2,\"2\":1})","context":{"sql":"UPDATE `tblusers` SET `email` = ? WHERE `id` = ?","params":{"1":"nschubert@example.org","2":70254},"types":{"1":2,"2":1}},"level":100,"level_name":"DEBUG","channel":"doctrine","datetime":"2025-06-11T16:45:56.145669+02:00","extra":{}}
pseudify  | {"message":"Error thrown while running command \"pseudify:pseudonymize whmcs-pseudify\". Message: \"An exception occurred while executing a query: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'nschubert@example.org' for key 'tblusers_email_unique'\"","context":{"exception":{"class":"Doctrine\\DBAL\\Exception\\UniqueConstraintViolationException","message":"An exception occurred while executing a query: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'nschubert@example.org' for key 'tblusers_email_unique'","code":1062,"file":"/opt/pseudify/core/vendor/doctrine/dbal/src/Driver/API/MySQL/ExceptionConverter.php:62","previous":{"class":"Doctrine\\DBAL\\Driver\\PDO\\Exception","message":"SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'nschubert@example.org' for key 'tblusers_email_unique'","code":1062,"file":"/opt/pseudify/core/vendor/doctrine/dbal/src/Driver/PDO/Exception.php:24","previous":{"class":"PDOException","message":"SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'nschubert@example.org' for key 'tblusers_email_unique'","code":23000,"file":"/opt/pseudify/core/vendor/doctrine/dbal/src/Driver/PDO/Statement.php:130"}}},"command":"pseudify:pseudonymize whmcs-pseudify","message":"An exception occurred while executing a query: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'nschubert@example.org' for key 'tblusers_email_unique'"},"level":500,"level_name":"CRITICAL","channel":"console","datetime":"2025-06-11T16:45:56.147507+02:00","extra":{}}
pseudify  | 16:45:56 CRITICAL  [console] Error thrown while running command "pseudify:pseudonymize whmcs-pseudify". Message: "An exception occurred while executing a query: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'nschubert@example.org' for key 'tblusers_email_unique'" ["exception" => Doctrine\DBAL\Exception\UniqueConstraintViolationException { …},"command" => "pseudify:pseudonymize whmcs-pseudify","message" => "An exception occurred while executing a query: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'nschubert@example.org' for key 'tblusers_email_unique'"]
pseudify  | {"message":"Command \"pseudify:pseudonymize whmcs-pseudify\" exited with code \"1062\"","context":{"command":"pseudify:pseudonymize whmcs-pseudify","code":1062},"level":100,"level_name":"DEBUG","channel":"console","datetime":"2025-06-11T16:45:56.162927+02:00","extra":{}}
pseudify  | 
pseudify  | In ExceptionConverter.php line 62:
pseudify  |                                                                                
pseudify  |   An exception occurred while executing a query: SQLSTATE[23000]: Integrity c  
pseudify  |   onstraint violation: 1062 Duplicate entry 'nschubert@example.org' for key '  
pseudify  |   tblusers_email_unique'                                                       
pseudify  |                                                                                
pseudify  | 
pseudify  | In Exception.php line 24:
pseudify  |                                                                                
pseudify  |   SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'nsch  
pseudify  |   ubert@example.org' for key 'tblusers_email_unique'                           
pseudify  |                                                                                
pseudify  | 
pseudify  | In Statement.php line 130:
pseudify  |                                                                                
pseudify  |   SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'nsch  
pseudify  |   ubert@example.org' for key 'tblusers_email_unique'                           
pseudify  |                                                                                
pseudify  | 
pseudify  | pseudify:pseudonymize [--connection CONNECTION] [-d|--dry-run] [-p|--parallel] [--concurrency CONCURRENCY] [--items-per-process ITEMS-PER-PROCESS] [--] <profile>
pseudify  | 
pseudify exited with code 255

It seems that multiple entries in the database are being pseudonymized into the same email address, which violates a UNIQUE constraint (tblusers_email_unique).

I’ve checked the documentation but couldn’t find a setting to avoid duplicate pseudonym values (e.g., for emails). Is there a recommended way to handle this scenario? Perhaps an option to ensure generated values are always unique?

Thanks in advance for your help – and again, thanks for sharing this project with the community!

Best regards
Sven

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions