Significant-Gravitas/AutoGPT · error · ValueError
Slug '{slug}' is already in use
Error message
Slug '{slug}' is already in use What it means
ValueError raised by create_org when the requested slug already exists as an organization slug. The API layer typically maps this to a 400/409. Slug uniqueness is enforced with a lookup before creation, so the transaction never starts in this case.
Source
Thrown at autogpt_platform/backend/backend/api/features/orgs/db.py:230
# ---------------------------------------------------------------------------
# Org CRUD
# ---------------------------------------------------------------------------
async def create_org(
name: str,
slug: str,
user_id: str,
description: str | None = None,
) -> OrgResponse:
"""Create a team organization and make the user the owner.
Raises:
ValueError: If the slug is already taken by another org or alias.
"""
existing_org = await prisma.organization.find_unique(where={"slug": slug})
if existing_org:
raise ValueError(f"Slug '{slug}' is already in use")
existing_alias = await prisma.organizationalias.find_unique(
where={"aliasSlug": slug}
)
if existing_alias:
raise ValueError(f"Slug '{slug}' is already in use as an alias")
# One transaction: a failure partway must not leave an org without its
# default workspace, owner membership, profile, seat, or balance row.
async with transaction() as tx:
org = await tx.organization.create(
data={
"name": name,
"slug": slug,
"description": description,
"isPersonal": False,
"bootstrapUserId": user_id,
"settings": "{}",
}View on GitHub (pinned to 9c8bb5550f)
Solutions
- Choose a different, more specific slug (add a suffix like -hq or -inc)
- If the slug belongs to an org you own, reuse that org instead of creating a new one
- Handle the error in the client by prompting the user for a new slug
Example fix
# before
org = await create_org(name="Acme", slug="acme", user_id=uid)
# after
try:
org = await create_org(name="Acme", slug="acme", user_id=uid)
except ValueError as e:
if "already in use" in str(e):
org = await create_org(name="Acme", slug="acme-2", user_id=uid) Defensive patterns
Strategy: try-catch
Validate before calling
existing = await prisma.organization.find_unique(where={"slug": slug})
if existing:
raise ValueError("slug taken — pick another before create") Try / catch
try:
org = await create_org(name=name, slug=slug, user_id=uid)
except ValueError as e:
if "already in use" in str(e):
slug = f"{slug}-{suffix()}"
org = await create_org(name=name, slug=slug, user_id=uid)
else:
raise Prevention
- Pre-check slug availability in the UI as the user types
- Auto-suffix on collision for machine-created orgs
- Never assume a failed create left no state — verify before retrying
When it happens
Trigger: POST create organization with a slug identical to an existing org's slug (e.g. 'acme-team' when another org already uses it).
Common situations: Auto-generated slugs colliding for common company names; retrying a create that actually succeeded on the first attempt; two users claiming the same slug simultaneously.
Related errors
- Slug '{slug}' is already in use as an alias
- Teams not found in this organization: {invalid}
- Cannot change the default workspace's join policy
- Failed to start OAuth flow
- Download failed: ${res.status}
AI-assisted analysis of Significant-Gravitas/AutoGPT@9c8bb5550f (2026-08-14).
Data as JSON: /api/errors/a7eea55b226a803f.
Report an issue: GitHub.