DEV Community

Md Mijanur Molla
Md Mijanur Molla

Posted on

I Created a URL Shortener Challenge… And AI Generated Duplicate Links 🔗

URL shorteners look simple.

Take a long URL → generate a short code → redirect.

That’s it.

But what if two different links get the same short URL?

So I created a challenge on VibeCode Arena to test this.

And the results were surprising.


🚨 The Problem

At first glance, everything works:

  • Generate a random short string
  • Map it to the original URL
  • Return the short link

Simple and clean.

But there’s a hidden issue.


⚠️ What Can Go Wrong?

In real-world systems:

• Random strings can collide

• Two users may get the same short URL

• One mapping can overwrite another

• Data gets lost or mixed

And suddenly:

👉 A short link redirects to the wrong website

👉 User trust is broken

👉 System becomes unreliable


🧠 Why This Happens

The problem is randomness without guarantees.

Just generating a random string does NOT ensure uniqueness.

And without proper checks:

👉 Collisions are inevitable


🤯 What I Observed

When AI models tried this challenge:

  • Some generated random short codes
  • Many ignored collision handling
  • Some didn’t check existing mappings
  • Very few ensured uniqueness properly

The code works.

But the system is not reliable.


🔍 The Real Issue

This is not just about shortening URLs.

It’s about:

• Uniqueness

• Data integrity

• Scalability

• Reliability

Because:

👉 One collision can break multiple links


💡 What a Better System Needs

A proper URL shortener should:

  • Check for existing short codes
  • Handle collisions safely
  • Use hashing or encoding strategies
  • Store mappings in a reliable database
  • Scale for millions of URLs

This ensures:

👉 Every short link is unique

👉 No data is overwritten


🔥 Try My Challenge

I created this challenge to test real-world system thinking.

👉 Try it here:
https://vibecodearena.ai/duel/d3e31c10-30b4-4d61-895f-d2751e71eaaf

Can you:

  • Prevent duplicate short URLs?
  • Handle collisions properly?
  • Design a scalable system?

🎯 Final Thought

URL shorteners don’t fail because of code.

They fail because of edge cases and scale.

And that’s where real engineering begins.


Try it and tell me 👇

Did AI handle uniqueness properly… or create duplicate links?

Top comments (0)