n8n-io/n8n · error · UserError

Could not find the user with the ID ${userId} or their perso

Error message

Could not find the user with the ID ${userId} or their personalProject.

What it means

Thrown inside `Reset.getProject()` when `--userId` is supplied but `ProjectRepository.getPersonalProjectForUser(userId)` returns null. This means either the user ID does not exist or the user has no personal project row, so there is nowhere to transfer the LDAP users' resources.

Source

Thrown at packages/cli/src/commands/ldap/reset.ts:159

		this.logger.info('Successfully reset the database to default ldap state.');
	}

	async getProject(userId?: string, projectId?: string) {
		if (projectId) {
			const project = await Container.get(ProjectRepository).findOneBy({ id: projectId });

			if (project === null) {
				throw new UserError(`Could not find the project with the ID ${projectId}.`);
			}

			return project;
		}

		if (userId) {
			const project = await Container.get(ProjectRepository).getPersonalProjectForUser(userId);

			if (project === null) {
				throw new UserError(
					`Could not find the user with the ID ${userId} or their personalProject.`,
				);
			}

			return project;
		}

		throw new UserError(wrongFlagsError);
	}

	async catch(error: Error): Promise<void> {
		this.logger.error('Error resetting database. See log messages for details.');
		this.logger.error(error.message);
	}

	private async getOwner() {
		const owner = await Container.get(UserRepository).findOne({
			where: { role: { slug: GLOBAL_OWNER_ROLE.slug } },

View on GitHub (pinned to 5ac6606e81)

Solutions

  1. Confirm the user exists via `n8n user-management:list` or the `user` table.
  2. Ensure the target user has logged in at least once so their personal project is initialized.
  3. Switch to `--projectId` of a shared project if the target user is not appropriate.

Example fix

// before
n8n ldap:reset --userId=<missing-or-deleted-id>
// after
n8n ldap:reset --userId=<active-local-user-id>
Defensive patterns

Strategy: validation

Validate before calling

const project = await projectRepo.getPersonalProjectForUser(userId);
if (!project) throw new Error(`User ${userId} does not exist or has no personal project.`);

Prevention

When it happens

Trigger: Passing a non-existent user ID; passing an ID of a user whose personal project was never created (e.g. an incomplete provisioning); passing an ID of a user that was already deleted.

Common situations: User was deactivated/cleaned up before the LDAP reset; typo in the user ID; targeting a service account that has no personal project.

Related errors


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