{"record":{"id":"79f89a3b100652e1","repo":"n8n-io/n8n","slug":"failed-to-find-owner-um-fix-instruction-79f89a","errorCode":null,"errorMessage":"Failed to find owner. ${UM_FIX_INSTRUCTION}","messagePattern":"Failed to find owner\\. (.+?)","errorType":"exception","errorClass":"UserError","httpStatus":null,"severity":"critical","filePath":"packages/cli/src/commands/ldap/reset.ts","lineNumber":181,"sourceCode":"\n\t\t\treturn project;\n\t\t}\n\n\t\tthrow new UserError(wrongFlagsError);\n\t}\n\n\tasync catch(error: Error): Promise<void> {\n\t\tthis.logger.error('Error resetting database. See log messages for details.');\n\t\tthis.logger.error(error.message);\n\t}\n\n\tprivate async getOwner() {\n\t\tconst owner = await Container.get(UserRepository).findOne({\n\t\t\twhere: { role: { slug: GLOBAL_OWNER_ROLE.slug } },\n\t\t\trelations: ['role'],\n\t\t});\n\t\tif (!owner) {\n\t\t\tthrow new UserError(`Failed to find owner. ${UM_FIX_INSTRUCTION}`);\n\t\t}\n\n\t\treturn owner;\n\t}\n}\n","sourceCodeStart":163,"sourceCodeEnd":187,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/cli/src/commands/ldap/reset.ts#L163-L187","documentation":"Thrown by `Reset.getOwner()` when no user with the `GLOBAL_OWNER_ROLE` slug exists in the database. The command needs an owner to perform deletions on behalf of (workflows, credentials). The message appends `UM_FIX_INSTRUCTION`, which tells the operator to run `n8n user-management:reset` to recreate the owner.","triggerScenarios":"The instance's owner user was deleted, the role seeding migration did not run, or the DB was partially restored. Any `ldap:reset` invocation will hit this before doing any work.","commonSituations":"Restoring a DB dump that predates role seeding; manual DB surgery that removed the owner row; fresh DB where owner setup was skipped.","solutions":["Run `./packages/cli/bin/n8n user-management:reset` as the message instructs to recreate the owner account.","Verify the `role` and `user` tables contain a row with `slug = 'owner'`.","Re-run `ldap:reset` once an owner exists."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"const owner = await userRepo.findOne({ where: { role: { slug: GLOBAL_OWNER_ROLE.slug } }, relations: ['role'] });\nif (!owner) {\n  console.error('No owner user found. Run: n8n user-management:reset');\n  process.exit(1);\n}","typeGuard":null,"tryCatchPattern":"try { await reset.run(); } catch (e) { if (/Failed to find owner/.test(e.message)) { await runUserManagementReset(); } else throw e; }","preventionTips":["Run `n8n user-management:reset` proactively after restoring a DB from backup.","Monitor for the presence of an owner row as part of DB health checks."],"tags":["cli","ldap","owner-missing","user-error"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}