Hitting this exception when restarting a build (full info https://code.redpointsoftware.com.au/harbormaster/build/435/)
exception 'AphrontQueryDuplicateKeyException' with message '#1062: Duplicate entry 'host-0fVqhny2LUO6' for key 'key_artifact'' in /srv/www/redpointsoftware.com.au/code/libphutil/src/aphront/storage/connection/mysql/AphrontMySQLDatabaseConnectionBase.php:299 2 Stack trace: 3 #0 /srv/www/redpointsoftware.com.au/code/libphutil/src/aphront/storage/connection/mysql/AphrontMySQLDatabaseConnectionBase.php(278): AphrontMySQLDatabaseConnectionBase->throwQueryCodeException(1062, 'Duplicate entry...') 4 #1 /srv/www/redpointsoftware.com.au/code/libphutil/src/aphront/storage/connection/mysql/AphrontMySQLDatabaseConnectionBase.php(184): AphrontMySQLDatabaseConnectionBase->throwQueryException(Object(mysqli)) 5 #2 /srv/www/redpointsoftware.com.au/code/libphutil/src/xsprintf/queryfx.php(9): AphrontMySQLDatabaseConnectionBase->executeRawQuery('INSERT INTO `ha...') 6 #3 [internal function]: queryfx(Object(AphrontMySQLiDatabaseConnection), '%Q INTO %T (%LC...', 'INSERT', 'harbormaster_bu...', Array, ''PHID-HMBT-thst...') 7 #4 /srv/www/redpointsoftware.com.au/code/libphutil/src/aphront/storage/connection/AphrontDatabaseConnection.php(28): call_user_func_array('queryfx', Array) 8 #5 /srv/www/redpointsoftware.com.au/code/phabricator/src/infrastructure/storage/lisk/LiskDAO.php(1266): AphrontDatabaseConnection->query('%Q INTO %T (%LC...', 'INSERT', 'harbormaster_bu...', Array, ''PHID-HMBT-thst...') 9 #6 /srv/www/redpointsoftware.com.au/code/phabricator/src/infrastructure/storage/lisk/LiskDAO.php(1123): LiskDAO->insertRecordIntoDatabase('INSERT') 10 #7 /srv/www/redpointsoftware.com.au/code/phabricator/src/infrastructure/storage/lisk/LiskDAO.php(1092): LiskDAO->insert() 11 #8 /srv/www/redpointsoftware.com.au/code/phabricator/src/applications/harbormaster/storage/build/HarbormasterBuild.php(133): LiskDAO->save() 12 #9 /srv/www/redpointsoftware.com.au/code/phabricator/src/applications/harbormaster/step/LeaseHostBuildStepImplementation.php(48): HarbormasterBuild->createArtifact(Object(HarbormasterBuildTarget), 'Linux Build Mac...', 'host') 13 #10 /srv/www/redpointsoftware.com.au/code/phabricator/src/applications/harbormaster/worker/HarbormasterTargetWorker.php(44): LeaseHostBuildStepImplementation->execute(Object(HarbormasterBuild), Object(HarbormasterBuildTarget)) 14 #11 /srv/www/redpointsoftware.com.au/code/phabricator/src/infrastructure/daemon/workers/PhabricatorWorker.php(84): HarbormasterTargetWorker->doWork() 15 #12 /srv/www/redpointsoftware.com.au/code/phabricator/src/infrastructure/daemon/workers/storage/PhabricatorWorkerActiveTask.php(122): PhabricatorWorker->executeTask() 16 #13 /srv/www/redpointsoftware.com.au/code/phabricator/src/infrastructure/daemon/workers/PhabricatorTaskmasterDaemon.php(19): PhabricatorWorkerActiveTask->executeTask() 17 #14 /srv/www/redpointsoftware.com.au/code/libphutil/src/daemon/PhutilDaemon.php(85): PhabricatorTaskmasterDaemon->run() 18 #15 /srv/www/redpointsoftware.com.au/code/libphutil/scripts/daemon/exec/exec_daemon.php(112): PhutilDaemon->execute() 19 #16 {main}
Seems like the artifacts aren't removed when restarting a build and when leasing a host it gets the same host identifier?