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:workflow (workflow.ts:297) when neither --userId nor --projectId is supplied AND no global owner user exists in the user repository. Identical logic to error 1314, on the workflow import path. UM_FIX_INSTRUCTION is: 'Please fix the database by running ./packages/cli/bin/n8n user-management:reset'.
Source
Thrown at packages/cli/src/commands/import/workflow.ts:297
this.logger.warn(`Skipping invalid workflow file: ${file}`);
continue;
}
}
return workflows;
}
private async getProject(userId?: string, projectId?: string) {
if (projectId) {
return await Container.get(ProjectRepository).findOneByOrFail({ id: projectId });
}
if (!userId) {
const owner = await Container.get(UserRepository).findOneBy({
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);
}
}
View on GitHub (pinned to 5ac6606e81)
Solutions
- Run `n8n user-management:reset` to recreate the owner account.
- Alternatively supply `--userId=<existing-user-id>` or `--projectId=<existing-project-id>` to bypass the owner lookup.
Example fix
// before — no owner row in DB n8n import:workflow --input=f.json // after n8n user-management:reset n8n import:workflow --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
- Run `n8n user-management:reset` after restoring a DB backup.
- Pass --projectId explicitly in scripts to avoid depending on the owner row.
When it happens
Trigger: `n8n import:workflow --input=f.json` (no owner flags) on a DB with no global owner user. The owner lookup at workflow.ts:293-295 returns null.
Common situations: Fresh DB where owner setup was skipped; DB restored from a backup missing the owner row; partial migration that wiped users.
Related errors
- Failed to find owner. ${UM_FIX_INSTRUCTION}
- File does not seem to contain valid workflows.
- The "--activeState=fromJson" flag can only be used when n8n
- You cannot use `--userId` and `--projectId` together. Use on
- The credential with ID "${workflow.id}" is already owned by
AI-assisted analysis of n8n-io/n8n@5ac6606e81 (2026-08-12).
Data as JSON: /api/errors/ca678b3ac338f039.
Report an issue: GitHub.