I suspect what happens is that in the api handler, we first create the instance in lxd and then we do db work. If the db work fails due to a serialization error, which is expected now and then, the whole request is retried and it will try to create a new instance with the same name in lxd.
It's quite hard to handle this properly without significant changes, but I'll take a look to see what we can do. I'm also going to see whether we changed something recently so that you see more serialization errors than before.
I suspect what happens is that in the api handler, we first create the instance in lxd and then we do db work. If the db work fails due to a serialization error, which is expected now and then, the whole request is retried and it will try to create a new instance with the same name in lxd.
It's quite hard to handle this properly without significant changes, but I'll take a look to see what we can do. I'm also going to see whether we changed something recently so that you see more serialization errors than before.