```
exception 'AphrontQueryDuplicateKeyException' with message '#1062: Duplicate entry 'PHID-PHRF-n6jez7lb5eyyll77k7re-338' for key 'key_version'' in /srv/phabricator/libphutil/src/aphront/storage/connection/mysql/AphrontMySQLDatabaseConnectionBase.php:296
2 Stack trace:
3 #0 /srv/phabricator/libphutil/src/aphront/storage/connection/mysql/AphrontMySQLDatabaseConnectionBase.php(275): AphrontMySQLDatabaseConnectionBase->throwQueryCodeException(1062, 'Duplicate entry...')
4 #1 /srv/phabricator/libphutil/src/aphront/storage/connection/mysql/AphrontMySQLDatabaseConnectionBase.php(181): AphrontMySQLDatabaseConnectionBase->throwQueryException(Object(mysqli))
5 #2 /srv/phabricator/libphutil/src/xsprintf/queryfx.php(6): AphrontMySQLDatabaseConnectionBase->executeRawQuery('INSERT INTO `ph...')
6 #3 [internal function]: queryfx(Object(AphrontMySQLiDatabaseConnection), '%Q INTO %T (%LC...', 'INSERT', 'phragment_fragm...', Array, ''338', 'PHID-PH...')
7 #4 /srv/phabricator/libphutil/src/aphront/storage/connection/AphrontDatabaseConnection.php(26): call_user_func_array('queryfx', Array)
8 #5 /srv/phabricator/phabricator/src/infrastructure/storage/lisk/LiskDAO.php(1280): AphrontDatabaseConnection->query('%Q INTO %T (%LC...', 'INSERT', 'phragment_fragm...', Array, ''338', 'PHID-PH...')
9 #6 /srv/phabricator/phabricator/src/infrastructure/storage/lisk/LiskDAO.php(1127): LiskDAO->insertRecordIntoDatabase('INSERT')
10 #7 /srv/phabricator/phabricator/src/infrastructure/storage/lisk/LiskDAO.php(1096): LiskDAO->insert()
11 #8 /srv/phabricator/phabricator/src/applications/phragment/storage/PhragmentFragment.php(149): LiskDAO->save()
12 #9 /srv/phabricator/phabricator/src/applications/phragment/storage/PhragmentFragment.php(256): PhragmentFragment->updateFromFile(Object(PhabricatorUser), Object(PhabricatorFile))
13 #10 /srv/phabricator/phabricator/src/applications/harbormaster/step/HarbormasterPublishFragmentBuildStepImplementation.php(103): PhragmentFragment->updateFromZIP(Object(PhabricatorUser), Object(PhabricatorFile))
14 #11 /srv/phabricator/phabricator/src/applications/harbormaster/worker/HarbormasterTargetWorker.php(46): HarbormasterPublishFragmentBuildStepImplementation->execute(Object(HarbormasterBuild), Object(HarbormasterBuildTarget))
15 #12 /srv/phabricator/phabricator/src/infrastructure/daemon/workers/PhabricatorWorker.php(87): HarbormasterTargetWorker->doWork()
16 #13 /srv/phabricator/phabricator/src/infrastructure/daemon/workers/storage/PhabricatorWorkerActiveTask.php(124): PhabricatorWorker->executeTask()
17 #14 /srv/phabricator/phabricator/src/infrastructure/daemon/workers/PhabricatorTaskmasterDaemon.php(19): PhabricatorWorkerActiveTask->executeTask()
18 #15 /srv/phabricator/libphutil/src/daemon/PhutilDaemon.php(84): PhabricatorTaskmasterDaemon->run()
19 #16 /srv/phabricator/libphutil/scripts/daemon/exec/exec_daemon.php(112): PhutilDaemon->execute()
20 #17 {main}
```
This might be caused by it trying to create a version for a fragment from two builds at once. We should probably lock around the individual fragment updates to prevent this.