n8n-io/n8n · error · NotFoundError

Request to delete a user failed because the transferee proje

Error message

Request to delete a user failed because the transferee project was not found in DB

What it means

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.

Source

Thrown at packages/cli/src/controllers/users.controller.ts:269

		const personalProjectToDelete = await this.projectRepository.getPersonalProjectForUserOrFail(
			userToDelete.id,
		);

		if (transferId === personalProjectToDelete.id) {
			throw new BadRequestError(
				'Request to delete a user failed because the user to delete and the transferee are the same user',
			);
		}

		let transfereeId;
		let transfereeProject: Project | null = null;

		if (transferId) {
			transfereeProject = await this.projectRepository.findOneBy({ id: transferId });

			if (!transfereeProject) {
				throw new NotFoundError(
					'Request to delete a user failed because the transferee project was not found in DB',
				);
			}

			const transfereeProjectId = transfereeProject.id;

			const transferee = await this.userRepository.findOneByOrFail({
				projectRelations: {
					projectId: transfereeProjectId,
				},
			});

			transfereeId = transferee.id;

			await this.ownershipTransferService.transferAllResources(
				[personalProjectToDelete.id],
				transfereeProjectId,
			);

View on GitHub (pinned to 5ac6606e81)

Solutions

  1. Confirm transferId is a project id (not a user id) and that it exists.
  2. Resolve the transferee's personal project id via GET /users/<transferee-id> before issuing the delete.
  3. If no transferee is needed, omit transferId.
Defensive patterns

Strategy: validation

Validate before calling

async function resolveTransferProjectId(transfereeUserId: string) {
  const r = await fetch(`/rest/users/${transfereeUserId}`);
  if (!r.ok) throw new Error('transferee user not found');
  const u = await r.json();
  return u.homeProjectId ?? u.personalProjectId;
}
const transferId = await resolveTransferProjectId(transfereeId);

Try / catch

try { await fetch(`/rest/users/${id}?transferId=${pid}`, { method: 'DELETE' }); }
catch (e) { if (e.statusCode === 404 && /transferee project/.test(e.message)) { /* wrong id type */ } else throw e; }

Prevention

When it happens

Trigger: DELETE /users/<id>?transferId=<unknown-or-deleted-project-id>; the supplied project id is not in the project table.

Common situations: Client sends a user id instead of a project id as transferId; project was deleted; cross-environment id copy; stale cached project id.

Related errors


AI-assisted analysis of n8n-io/n8n@5ac6606e81 (2026-08-12). Data as JSON: /api/errors/300f0af74b9e7fba. Report an issue: GitHub.