Lurker News
I know what you're thinking... and I still can't believe it, but...

This morning, our database flagged a duplicate UUID (v4). I checked, thinking it may have been a double-insert bug or something, but no.
The original UUID was from a record added in 2025 (about a year ago), and today the system inserted a new document with a fresh UUIDv4 and it came up with the exact same one:
b6133fd6-70fe-4fe3-bed6-8ca8fc9386cd
We're using this: https://www.npmjs.com/package/uuid
I thought this is technically impossible, and it will never happen, and since we're not modifying the UUIDs in any way, I really wonder how that.... is possible!? We're literally only calling:
import { v4 as uuidv4 } from "uuid";
const document_id = uuidv4();
... and then insert into the database, that's it.
Additionally, the database only has about 15.000 records, and now one collision. Statistically... impossible.
Has that ever happened to anyone?! What in the...

Comments (347) 79 threads

Show all comments

Showing thread 5 of 79

adyavanapalli5 replies#
What you're talking about is so extremely rare that it's much more likely that the entire Earth is destroyed by an asteroid right this inst...
delichon2 replies#
About as rare as an asteroid typing an ellipsis and clicking the add comment button.
throw0101c#
Well, this joke dates back to (at least) the dial-up days where {#`%${%&`+'${`%& NO CARRIER
xerox13ster#
That’s just a result of jounce from localized gravity effects and atmospheric pressure disturbances in the moments before impact.

Think the ultrasonic typing hacking scene in Pantheon combined with the keyboard bouncing due to rumbling.

sebazzz#
Well it would be statistically even rarer for that UUID collision to happen and the earth to be destroyed by an asteroid.
crazylogger1 reply#
For a single database using UUIDs, yes, it's astronomically rare. But it's quite a different thing to say that no computer system on Earth has ever experienced a UUID collision. The number of systems out there is also astronomical.
nathanmills1 reply#
>The number of systems out there is also astronomical.

Not even close

moi2388#
Sure it does. Planets are astronomical, and we only have 8 of those in our solar system.
thomasmg#
It is not quite as rare. I calculated it to be less common than being hit by a meteorite, and added a section about that and the Birthday Paradox to Wikipedia, to the article about UUIDs. It got removed / replaced a few years ago however. (If my source was correct, there was actually a woman hit by a meteorite, but she survived, with a leg injury.)

If you do have a UUID collision, chances are extremely high that it's either a software bug, or glitch in the computer. It could be a cosmic ray. Cosmic rays messing with the computer memory or CPU are actually relatively common.

spindump8930#
It's very common if you improperly seed, as others in the thread brought up! Or in your framing, as rare as earth getting hit if it were surrounded by a sci-fi density asteroid field.