{"record":{"id":"300f0af74b9e7fba","repo":"n8n-io/n8n","slug":"request-to-delete-a-user-failed-because-the-transf","errorCode":null,"errorMessage":"Request to delete a user failed because the transferee project was not found in DB","messagePattern":"Request to delete a user failed because the transferee project was not found in DB","errorType":"exception","errorClass":"NotFoundError","httpStatus":404,"severity":"error","filePath":"packages/cli/src/controllers/users.controller.ts","lineNumber":269,"sourceCode":"\n\t\tconst personalProjectToDelete = await this.projectRepository.getPersonalProjectForUserOrFail(\n\t\t\tuserToDelete.id,\n\t\t);\n\n\t\tif (transferId === personalProjectToDelete.id) {\n\t\t\tthrow new BadRequestError(\n\t\t\t\t'Request to delete a user failed because the user to delete and the transferee are the same user',\n\t\t\t);\n\t\t}\n\n\t\tlet transfereeId;\n\t\tlet transfereeProject: Project | null = null;\n\n\t\tif (transferId) {\n\t\t\ttransfereeProject = await this.projectRepository.findOneBy({ id: transferId });\n\n\t\t\tif (!transfereeProject) {\n\t\t\t\tthrow new NotFoundError(\n\t\t\t\t\t'Request to delete a user failed because the transferee project was not found in DB',\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tconst transfereeProjectId = transfereeProject.id;\n\n\t\t\tconst transferee = await this.userRepository.findOneByOrFail({\n\t\t\t\tprojectRelations: {\n\t\t\t\t\tprojectId: transfereeProjectId,\n\t\t\t\t},\n\t\t\t});\n\n\t\t\ttransfereeId = transferee.id;\n\n\t\t\tawait this.ownershipTransferService.transferAllResources(\n\t\t\t\t[personalProjectToDelete.id],\n\t\t\t\ttransfereeProjectId,\n\t\t\t);","sourceCodeStart":251,"sourceCodeEnd":287,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/cli/src/controllers/users.controller.ts#L251-L287","documentation":"Thrown by DELETE /users/:id when a transferId is supplied but projectRepository.findOneBy({id:transferId}) returns null — the referenced transferee project does not exist. HTTP 404. Fires after the same-user check; the next step would resolve the transferee user via that project.","triggerScenarios":"DELETE /users/<id>?transferId=<unknown-or-deleted-project-id>; the supplied project id is not in the project table.","commonSituations":"Client sends a user id instead of a project id as transferId; project was deleted; cross-environment id copy; stale cached project id.","solutions":["Confirm transferId is a project id (not a user id) and that it exists.","Resolve the transferee's personal project id via GET /users/<transferee-id> before issuing the delete.","If no transferee is needed, omit transferId."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"async function resolveTransferProjectId(transfereeUserId: string) {\n  const r = await fetch(`/rest/users/${transfereeUserId}`);\n  if (!r.ok) throw new Error('transferee user not found');\n  const u = await r.json();\n  return u.homeProjectId ?? u.personalProjectId;\n}\nconst transferId = await resolveTransferProjectId(transfereeId);","typeGuard":null,"tryCatchPattern":"try { await fetch(`/rest/users/${id}?transferId=${pid}`, { method: 'DELETE' }); }\ncatch (e) { if (e.statusCode === 404 && /transferee project/.test(e.message)) { /* wrong id type */ } else throw e; }","preventionTips":["Confirm transferId is a project id that exists (GET /projects/:id).","Do not pass a user id as transferId.","If no transfer is needed, omit transferId."],"tags":["users","delete","ownership-transfer","rest-api","not-found"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}