open-webui/open-webui · error · HTTPException

Uh-oh! This id is already registered. Please choose another

Error message

Uh-oh! This id is already registered. Please choose another id string.

What it means

Raised by the knowledge update-by-id route when the request attempts to change the knowledge id to a value that already exists. The route checks whether a different knowledge row already occupies the requested id and rejects with ID_TAKEN. It is a uniqueness guard on the primary identifier.

Source

Thrown at backend/open_webui/routers/knowledge.py:1156

            request,
            knowledge.id,
            knowledge.name,
            knowledge.description,
        )
        response = KnowledgeFilesResponse(
            **knowledge.model_dump(),
            files=await Knowledges.get_file_metadatas_by_id(knowledge.id),
        )
        await publish_event(
            request,
            EVENTS.KNOWLEDGE_UPDATED,
            actor=user,
            subject_id=knowledge.id,
            data={'name': knowledge.name},
        )
        return response
    else:
        raise HTTPException(
            status_code=status.HTTP_400_BAD_REQUEST,
            detail=ERROR_MESSAGES.ID_TAKEN,
        )


############################
# UpdateKnowledgeAccessById
############################


class KnowledgeAccessGrantsForm(BaseModel):
    access_grants: list[dict]


@router.post('/{id}/access/update', response_model=KnowledgeFilesResponse | None)
async def update_knowledge_access_by_id(
    request: Request,
    id: str,

View on GitHub (pinned to 01f4282f1f)

Solutions

  1. Do not send an 'id' field in the update payload unless renaming; omit it to keep the existing id
  2. If renaming is intended, pick a fresh unique id string
  3. Look up the conflicting knowledge row (GET /api/v1/knowledge/) and delete or rename it first

Example fix

// before
await updateKnowledgeById(id, { ...form, id: 'shared-kb' }); // ID_TAKEN

// after
const { id: _omit, ...rest } = form;
await updateKnowledgeById(id, rest);
Defensive patterns

Strategy: validation

Validate before calling

const existing = await listKnowledge();
const taken = existing.some(k => k.id === form.id && k.id !== currentId);
if (taken) throw new DuplicateIdError(form.id);

Type guard

function isIdCollision(formId: string, currentId: string, allIds: string[]): boolean {
  return formId !== currentId && allIds.includes(formId);
}

Try / catch

try { await updateKnowledgeById(id, payload); } catch (e) { if (e.detail?.includes('already registered')) { payload = { ...payload, id: generateId() }; await updateKnowledgeById(id, payload); } else throw e; }

Prevention

When it happens

Trigger: POST /api/v1/knowledge/{id}/update where form_data.id differs from the path id and matches another existing knowledge row's id.

Common situations: Frontend form round-trips a stale id; an import/copy script tries to merge two knowledge bases by renaming one onto the other's id; a race where two clients create knowledge with the same slug-like id.

Related errors


AI-assisted analysis of open-webui/open-webui@01f4282f1f (2026-08-14). Data as JSON: /api/errors/6efc39d882e7a6cc. Report an issue: GitHub.