n8n-io/n8n · warning · BadRequestError

You must set up your own account before inviting others

Error message

You must set up your own account before inviting others

What it means

A BadRequestError (HTTP 400) thrown when ownershipService.hasInstanceOwner() resolves false. The instance has no fully set-up owner account (the initial setup was never completed), so it cannot send invites because there is no owner to attribute them to. Logged at debug level before throwing.

Source

Thrown at packages/cli/src/controllers/invitation.controller.ts:73

				'SSO is enabled, so users are managed by the Identity Provider and cannot be added through invites',
			);
			throw new BadRequestError(
				'SSO is enabled, so users are managed by the Identity Provider and cannot be added through invites',
			);
		}

		if (!isWithinUsersLimit) {
			this.logger.debug(
				'Request to send email invite(s) to user(s) failed because the user limit quota has been reached',
			);
			throw new ForbiddenError(RESPONSE_ERROR_MESSAGES.USERS_QUOTA_REACHED);
		}

		if (!(await this.ownershipService.hasInstanceOwner())) {
			this.logger.debug(
				'Request to send email invite(s) to user(s) failed because the owner account is not set up',
			);
			throw new BadRequestError('You must set up your own account before inviting others');
		}

		const attributes = invitations.map(({ email, role }) => {
			if (role === 'global:admin' && !this.license.isAdvancedPermissionsLicensed()) {
				throw new ForbiddenError(
					'Cannot invite admin user without advanced permissions. Please upgrade to a license that includes this feature.',
				);
			}
			return { email, role };
		});

		const { usersInvited, usersCreated } = await this.userService.inviteUsers(req.user, attributes);

		await this.externalHooks.run('user.invited', [usersCreated]);

		return usersInvited;
	}

View on GitHub (pinned to 5ac6606e81)

Solutions

  1. Complete the initial owner account setup by visiting the instance URL in a browser and finishing the setup wizard.
  2. If the owner row was deleted from the DB, restore it or re-run the setup flow.
  3. Verify ownershipService.hasInstanceOwner() returns true via the Admin UI before retrying invites.
  4. Check that the user table has at least one user with the global:owner role.
Defensive patterns

Strategy: validation

Validate before calling

// Ensure an owner exists before inviting.
const users = await api.get('/users');
const hasOwner = users.some((u) => u.role === 'global:owner');
if (!hasOwner) throw new Error('Complete owner setup first');

Type guard

function instanceHasOwner(users: Array<{ role: string }>): boolean {
  return users.some((u) => u.role === 'global:owner');
}

Try / catch

try {
  await api.post('/invite', invites);
} catch (e) {
  if (e.response?.status === 400 && /set up your own account/i.test(e.response.data.message)) {
    redirect('/setup');
    return;
  }
  throw e;
}

Prevention

When it happens

Trigger: POST /invite on a freshly deployed instance where the owner account setup page was skipped or never completed, or where the owner user row was deleted manually from the DB. The check runs after the SSO and quota checks.

Common situations: Instance deployed via Docker/compose but the first-run owner setup was bypassed; an operator deleted the owner user directly in the database; restored DB backup that lost the owner row; automated setup script that created users before completing owner setup.

Related errors


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