n8n-io/n8n · error · UserError
Failed to find owner. ${UM_FIX_INSTRUCTION}
Error message
Failed to find owner. ${UM_FIX_INSTRUCTION} What it means
Thrown by getProject in import:credentials when neither --userId nor --projectId is supplied AND no global owner user exists in the DB. Without an explicit assignment target, n8n falls back to the global owner's personal project; if that user is missing the import cannot proceed. UM_FIX_INSTRUCTION is the string: 'Please fix the database by running ./packages/cli/bin/n8n user-management:reset'.
Source
Thrown at packages/cli/src/commands/import/credentials.ts:505
}
private async credentialExists(transactionManager: EntityManager, credentialId: string) {
return await transactionManager.existsBy(CredentialsEntity, { id: credentialId });
}
private async getProject(transactionManager: EntityManager, userId?: string, projectId?: string) {
if (projectId) {
return await transactionManager.findOneByOrFail(Project, { id: projectId });
}
if (!userId) {
const owner = await transactionManager.findOneBy(User, {
role: {
slug: GLOBAL_OWNER_ROLE.slug,
},
});
if (!owner) {
throw new UserError(`Failed to find owner. ${UM_FIX_INSTRUCTION}`);
}
userId = owner.id;
}
return await Container.get(ProjectRepository).getPersonalProjectForUserOrFail(
userId,
transactionManager,
);
}
}
View on GitHub (pinned to 5ac6606e81)
Solutions
- Run `n8n user-management:reset` to recreate the owner account (this is the message's literal instruction).
- Alternatively supply `--userId=<existing-user-id>` or `--projectId=<existing-project-id>` to bypass the owner lookup.
Example fix
// before — fails because no owner row exists n8n import:credentials --input=f.json // after — recreate owner, then import n8n user-management:reset n8n import:credentials --input=f.json
Defensive patterns
Strategy: validation
Validate before calling
async function ownerExists(ds: DataSource): Promise<boolean> {
return await ds.getRepository('user').exist({ where: { role: { slug: 'owner' } } });
}
if (!flags.userId && !flags.projectId && !(await ownerExists(ds))) {
throw new Error('No global owner — run: n8n user-management:reset');
} Prevention
- Always run `n8n user-management:reset` after restoring a DB from backup.
- In CI/scripts, pass --projectId explicitly to avoid relying on the owner row.
When it happens
Trigger: `n8n import:credentials --input=f.json` (no owner flags) on a DB where the global owner role has no user row. Common after a partial DB wipe, a corrupted user-management setup, or importing into a DB that was never fully initialised.
Common situations: Fresh DB where owner setup was skipped; DB restored from a backup missing the owner row; migrations that touched the user/role tables.
Related errors
- Failed to find owner. ${UM_FIX_INSTRUCTION}
- You cannot use `--userId` and `--projectId` together. Use on
- You cannot use `--include` and `--exclude` together. Use one
- Provider connection type cannot be changed. Create a new con
- Provider connections cannot be global, managed, or dynamical
AI-assisted analysis of n8n-io/n8n@5ac6606e81 (2026-08-12).
Data as JSON: /api/errors/21be4f2e4b1d56fe.
Report an issue: GitHub.