{"record":{"id":"ca678b3ac338f039","repo":"n8n-io/n8n","slug":"failed-to-find-owner-um-fix-instruction-ca678b","errorCode":null,"errorMessage":"Failed to find owner. ${UM_FIX_INSTRUCTION}","messagePattern":"Failed to find owner\\. (.+?)","errorType":"exception","errorClass":"UserError","httpStatus":null,"severity":"error","filePath":"packages/cli/src/commands/import/workflow.ts","lineNumber":297,"sourceCode":"\t\t\t\tthis.logger.warn(`Skipping invalid workflow file: ${file}`);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\n\t\treturn workflows;\n\t}\n\n\tprivate async getProject(userId?: string, projectId?: string) {\n\t\tif (projectId) {\n\t\t\treturn await Container.get(ProjectRepository).findOneByOrFail({ id: projectId });\n\t\t}\n\n\t\tif (!userId) {\n\t\t\tconst owner = await Container.get(UserRepository).findOneBy({\n\t\t\t\trole: { slug: GLOBAL_OWNER_ROLE.slug },\n\t\t\t});\n\t\t\tif (!owner) {\n\t\t\t\tthrow new UserError(`Failed to find owner. ${UM_FIX_INSTRUCTION}`);\n\t\t\t}\n\t\t\tuserId = owner.id;\n\t\t}\n\n\t\treturn await Container.get(ProjectRepository).getPersonalProjectForUserOrFail(userId);\n\t}\n}\n","sourceCodeStart":279,"sourceCodeEnd":305,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/cli/src/commands/import/workflow.ts#L279-L305","documentation":"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'.","triggerScenarios":"`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.","commonSituations":"Fresh DB where owner setup was skipped; DB restored from a backup missing the owner row; partial migration that wiped users.","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."],"exampleFix":"// before — no owner row in DB\nn8n import:workflow --input=f.json\n// after\nn8n user-management:reset\nn8n import:workflow --input=f.json","handlingStrategy":"validation","validationCode":"async function ownerExists(ds: DataSource): Promise<boolean> {\n  return await ds.getRepository('user').exist({ where: { role: { slug: 'owner' } } });\n}\nif (!flags.userId && !flags.projectId && !(await ownerExists(ds))) {\n  throw new Error('No global owner — run: n8n user-management:reset');\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run `n8n user-management:reset` after restoring a DB backup.","Pass --projectId explicitly in scripts to avoid depending on the owner row."],"tags":["cli","import","workflow","owner","user-management","database","user-error"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}