Drone builds stuck in running state

All the builds repeatedly fail with logs similar to the following:

{"build.id":45,"build.number":2,"error":"UNIQUE constraint failed: steps.step_stage_id, steps.step_number","level":"warning","msg":"manager: cannot persist the step","repo.id":78,"stage.id":45,"stage.status":"running","step.id":0,"step.name":"clone","time":"2019-01-29T20:01:29Z"}
{"build.id":45,"build.number":2,"error":"Optimistic Lock Error","level":"warning","msg":"manager: cannot persist the step","repo.id":78,"stage.id":45,"stage.status":"error","step.id":0,"step.name":"clone","time":"2019-01-29T20:01:29Z"}