immich-app/immich · error

User does not exist

Error message

User does not exist

What it means

`grantAdminAccess` resolves the target user by email via userRepository.getByEmail(email). If no user matches the given email, it throws 'User does not exist' instead of promoting a nonexistent account. This is a plain Error thrown from the CLI service layer.

Solutions

  1. Verify the exact email: list users (or query SELECT email FROM "user") and copy the address verbatim.
  2. Check you are connected to the intended database via the CLI environment configuration.
  3. Create the user first if it genuinely does not exist, then run grant-admin again.

Example fix

// before
$ immich-admin grant-admin Bob@Example.com    // typo in stored email → User does not exist
// after
$ immich-admin grant-admin bob@example.com    # exact email as registered
Defensive patterns

Strategy: validation

Validate before calling

// Confirm the exact registered email before granting admin
const users = await api.searchUsers();
const target = users.find(u => u.email.toLowerCase() === email.trim().toLowerCase());
if (!target) throw new Error(`No user with email ${email}`);

Prevention

When it happens

Trigger: Running the grant-admin CLI command with an email that has no matching row in the user table, e.g. `immich-admin grant-admin bob@wrongdomain.com`.

Common situations: Typos in the email address; user registered with a different email than expected; case/whitespace mismatch; operating against a different database environment (staging vs production).

Understand the failure class

Background: "User not found", "Invalid user", and "does not exist": what missing-user lookup errors mean across Rocket.Chat, LiteLLM, Phabricator, rustfs, and pnpm — this error's family across 10 libraries.

Related errors


AI-assisted analysis of immich-app/immich@e55ac299a4 (2026-09-15). Data as JSON: /api/errors/5e1e8746140d437f. Report an issue: GitHub.

Appendix: source

Thrown at server/src/services/cli.service.ts:155

      action: {
        action: MaintenanceAction.Start,
      },
    });

    await this.appRepository.sendOneShotAppRestart({
      isMaintenanceMode: true,
    });

    return {
      authUrl: await createMaintenanceLoginUrl(baseUrl, payload, secret),
      alreadyEnabled: false,
    };
  }

  async grantAdminAccess(email: string): Promise<void> {
    const user = await this.userRepository.getByEmail(email);
    if (!user) {
      throw new Error('User does not exist');
    }

    await this.userRepository.update(user.id, { isAdmin: true });
  }

  async revokeAdminAccess(email: string): Promise<void> {
    const user = await this.userRepository.getByEmail(email);
    if (!user) {
      throw new Error('User does not exist');
    }

    await this.userRepository.update(user.id, { isAdmin: false });
  }

  async disableOAuthLogin(): Promise<void> {
    const config = await this.getConfig({ withCache: false });
    config.oauth.enabled = false;
    await this.updateConfig(config);

View on GitHub (pinned to e55ac299a4)