{"record":{"id":"6efc39d882e7a6cc","repo":"open-webui/open-webui","slug":"uh-oh-this-id-is-already-registered-please-choos-6efc39","errorCode":null,"errorMessage":"Uh-oh! This id is already registered. Please choose another id string.","messagePattern":"Uh-oh! This id is already registered\\. Please choose another id string\\.","errorType":"http","errorClass":"HTTPException","httpStatus":400,"severity":"error","filePath":"backend/open_webui/routers/knowledge.py","lineNumber":1156,"sourceCode":"            request,\n            knowledge.id,\n            knowledge.name,\n            knowledge.description,\n        )\n        response = KnowledgeFilesResponse(\n            **knowledge.model_dump(),\n            files=await Knowledges.get_file_metadatas_by_id(knowledge.id),\n        )\n        await publish_event(\n            request,\n            EVENTS.KNOWLEDGE_UPDATED,\n            actor=user,\n            subject_id=knowledge.id,\n            data={'name': knowledge.name},\n        )\n        return response\n    else:\n        raise HTTPException(\n            status_code=status.HTTP_400_BAD_REQUEST,\n            detail=ERROR_MESSAGES.ID_TAKEN,\n        )\n\n\n############################\n# UpdateKnowledgeAccessById\n############################\n\n\nclass KnowledgeAccessGrantsForm(BaseModel):\n    access_grants: list[dict]\n\n\n@router.post('/{id}/access/update', response_model=KnowledgeFilesResponse | None)\nasync def update_knowledge_access_by_id(\n    request: Request,\n    id: str,","sourceCodeStart":1138,"sourceCodeEnd":1174,"githubUrl":"https://github.com/open-webui/open-webui/blob/01f4282f1ffe0d6212f58d3afbeae21fffd0c4be/backend/open_webui/routers/knowledge.py#L1138-L1174","documentation":"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.","triggerScenarios":"POST /api/v1/knowledge/{id}/update where form_data.id differs from the path id and matches another existing knowledge row's id.","commonSituations":"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.","solutions":["Do not send an 'id' field in the update payload unless renaming; omit it to keep the existing id","If renaming is intended, pick a fresh unique id string","Look up the conflicting knowledge row (GET /api/v1/knowledge/) and delete or rename it first"],"exampleFix":"// before\nawait updateKnowledgeById(id, { ...form, id: 'shared-kb' }); // ID_TAKEN\n\n// after\nconst { id: _omit, ...rest } = form;\nawait updateKnowledgeById(id, rest);","handlingStrategy":"validation","validationCode":"const existing = await listKnowledge();\nconst taken = existing.some(k => k.id === form.id && k.id !== currentId);\nif (taken) throw new DuplicateIdError(form.id);","typeGuard":"function isIdCollision(formId: string, currentId: string, allIds: string[]): boolean {\n  return formId !== currentId && allIds.includes(formId);\n}","tryCatchPattern":"try { await updateKnowledgeById(id, payload); } catch (e) { if (e.detail?.includes('already registered')) { payload = { ...payload, id: generateId() }; await updateKnowledgeById(id, payload); } else throw e; }","preventionTips":["Omit 'id' from update payloads unless intentionally renaming","Generate ids server-side or via UUID to avoid collisions","Handle the error by regenerating the id, not by blind retry"],"tags":["uniqueness","knowledge","duplicate-id","open-webui"],"backgroundTag":null,"analyzedSha":"01f4282f1ffe0d6212f58d3afbeae21fffd0c4be","analyzedAt":"2026-08-14T18:25:22.715Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}