Error 1062: Duplicate entry 'XXXXX' for key 'PRIMARY'

Drone is connected to BitBucket.
Drone version - drone:1.4
When drone tries to write last step of the build to MySQL it fails with the following message "Error 1062: Duplicate entry ‘log_id’ for key ‘Primary’.
On MySQL side, if I check what was written inside that log_id
e.g.: select * from logs where log_id=40258; I get all of the build log except the last step of the pipeline.

What I tried:
I tried to clone the repo, create new repo and run the pipeline successfully
I tried to make a dummy commit into the failing repo, same fail with Duplicate entry, restarting the pipeline results in the same Duplicate entry.

Any idea what is causing this?