ALREADY_EXISTS 🔌 API

API Error: Resource already exists (ALREADY_EXISTS / resource_already_exists / 409)

The create request was refused because an object with the same unique identity — name, email, external ID — already exists.

Seen on: REST API

Meaning

Most APIs enforce uniqueness on some field. gRPC and Google Cloud APIs return status ALREADY_EXISTS, others resource_already_exists, duplicate_resource or a plain 409 Conflict with “already exists”.

It very often happens on retries: the first create actually succeeded but the response was lost (timeout), so the client tried again.

Common causes

  • An object with the same unique key really exists
  • A timed-out create succeeded and the retry duplicates it
  • Two workers created the same object concurrently
  • Soft-deleted object still reserves the name

⚡ Quick fix

  1. Look up the existing object and use it (get-or-create)
  2. Use an idempotency key so retries return the original result
  3. Choose a different unique value if it’s a genuine clash

Detailed fix by platform

Node.js

  1. `try { await api.create({ name }); } catch (e) { if (e.status === 409
  2. e.code === 'ALREADY_EXISTS') return api.getByName(name); throw e; }`

gcloud

  1. `gcloud pubsub topics describe my-topic
  2. gcloud pubsub topics create my-topic # create only if missing`

How to diagnose

  1. Search — Does an object with that key exist already?
  2. Retries — Did an earlier attempt time out?
  3. Concurrency — Multiple creators?

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.