langflow-ai/langflow · error · HTTPException

Endpoint name must be unique

Error message

Endpoint name must be unique

What it means

HTTP 409 (Conflict) from _deduplicate_endpoint_name: the requested endpoint_name already exists for this user and the caller passed fail_on_conflict=True (the PUT upsert path, which must fail predictably instead of silently renaming). The check is per-user: an exact match on Flow.endpoint_name within the same user_id blocks the request.

Source

Thrown at src/backend/base/langflow/api/v1/flows_helpers.py:235

    session: AsyncSession,
    endpoint_name: str,
    user_id: UUID,
    *,
    fail_on_conflict: bool = False,
) -> str:
    """Return a unique endpoint name for *user_id*, appending ``-N`` if needed.

    Raises :class:`HTTPException` 409 when *fail_on_conflict* is ``True`` and
    the name already exists.
    """
    existing = (
        await session.exec(select(Flow).where(Flow.endpoint_name == endpoint_name).where(Flow.user_id == user_id))
    ).first()
    if not existing:
        return endpoint_name

    if fail_on_conflict:
        raise HTTPException(status_code=409, detail="Endpoint name must be unique")

    flows = (
        await session.exec(
            select(Flow)
            .where(Flow.endpoint_name.like(f"{endpoint_name}-%"))  # type: ignore[union-attr]
            .where(Flow.user_id == user_id)
        )
    ).all()

    numbers: list[int] = []
    for f in flows:
        try:
            numbers.append(int(f.endpoint_name.split("-")[-1]))
        except ValueError:
            continue

    next_num = (max(numbers) + 1) if numbers else 1
    return f"{endpoint_name}-{next_num}"

View on GitHub (pinned to 976ec789d2)

Solutions

  1. Pick a unique endpoint_name before the PUT.
  2. Delete or rename the flow that currently holds the conflicting endpoint_name.
  3. Use POST (create) instead of PUT if you want the -N auto-renaming behaviour instead of a 409.
  4. On 409, GET your flows filtered by endpoint_name to find the collision, then retry with a suffixed name.

Example fix

# before
PUT /api/v1/flows/{id}  {"endpoint_name": "my-api"}   # another flow owns it
# after
PUT /api/v1/flows/{id}  {"endpoint_name": "my-api-2"}
Defensive patterns

Strategy: validation

Validate before calling

const mine = await listFlows();
if (mine.some(f => f.endpoint_name === body.endpoint_name)) throw new Error('endpoint_name taken');

Try / catch

try { await putFlow(id, body) } catch (e) { if (e.status === 409) { body.endpoint_name += '-2'; return putFlow(id, body); } throw e; }

Prevention

When it happens

Trigger: PUT /api/v1/flows/{id} (upsert for instance syncing) with endpoint_name that another of your flows already owns; re-running a sync after a partial import duplicated endpoint names.

Common situations: Syncing the same flow twice under different flow ids; importing a bundle whose endpoint names collide with existing local flows; renaming a flow to an endpoint_name you already used.

Related errors


AI-assisted analysis of langflow-ai/langflow@976ec789d2 (2026-08-14). Data as JSON: /api/errors/2f082fc40ee8d2a9. Report an issue: GitHub.