immich-app/immich · error · Error
User does not exist
Error message
User does not exist
What it means
Thrown (plain Error) by CliService.grantAdminAccess when no user matches the supplied email (userRepository.getByEmail returns null). The grant flow cannot promote a user that does not exist.
Source
Thrown at server/src/services/cli.service.ts:156
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 199723261c)
Solutions
- List users first (cli listUsers) and copy the exact email from the output.
- Verify DATABASE_URL targets the right instance.
- Normalize email case to match what is stored before passing it to the command.
Example fix
// before
await cliService.grantAdminAccess(emailArg);
// after
const user = await userRepository.getByEmail(emailArg.trim().toLowerCase());
if (!user) {
throw new Error(`No user found for ${emailArg}. Run 'listUsers' to confirm the email.`);
}
await cliService.grantAdminAccess(user.email); Defensive patterns
Strategy: validation
Validate before calling
const user = await userRepository.getByEmail(email.trim().toLowerCase());
if (!user) throw new Error(`No user found for ${email}; run listUsers to verify.`); Prevention
- Run listUsers and copy the exact email before grant/revoke commands.
- Normalize email case to match stored values.
- Verify the CLI talks to the correct database via DATABASE_URL.
When it happens
Trigger: Running the CLI command to grant admin access with an email that is not present in the users table.
Common situations: Typo in the email argument; wrong database (DATABASE_URL); the target user was deleted; case mismatch in the email.
Related errors
- The first registered account must the administrator.
- Admin account does not exist
- User not found
- Forbidden
- Admin setup is not available
AI-assisted analysis of immich-app/immich@199723261c (2026-08-12).
Data as JSON: /api/errors/5e1e8746140d437f.
Report an issue: GitHub.