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 7 of 79

Geee4 replies#
According to the many-worlds interpretation of quantum mechanics, there's bound to be one branch of universe where every UUID is the same. Can you imagine what those guys are thinking?
nyantaro1#
This is why I am not a fan of the Everett approach
zeeveener#
"Huh, this is just an identity function. Cool. Let's move on."
BobaFloutist1 reply#
Not only that, there's vastly more where every UUID except one is the same, but they never got to that one because they didn't ever use them.

Or where the first two are unique, but every following one is one of the first two.

beng-nl#
One where all uuids are always different whenever the person who wrote the implementation tries it, regardless of computer. And whenever it’s someone else, always the same.
suprjami#
They probably just generate "the UUID" then add an increasing number on the end so it's unique. Problem solved.