{"record":{"id":"2a563d2f9792984a","repo":"jesseduffield/lazygit","slug":"no-config-file-found","errorCode":null,"errorMessage":"No config file found","messagePattern":"No config file found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"info","filePath":"pkg/gui/controllers/edit_config_action.go","lineNumber":18,"sourceCode":"package controllers\n\nimport (\n\t\"errors\"\n\n\t\"github.com/jesseduffield/lazygit/pkg/gui/types\"\n\t\"github.com/samber/lo\"\n)\n\ntype EditConfigAction struct {\n\tc *ControllerCommon\n}\n\nfunc (self *EditConfigAction) Call() error {\n\tconfPaths := self.c.GetConfig().GetUserConfigPaths()\n\tswitch len(confPaths) {\n\tcase 0:\n\t\treturn errors.New(self.c.Tr.NoConfigFileFoundErr)\n\tcase 1:\n\t\treturn self.c.Helpers().Files.EditFiles(confPaths)\n\tdefault:\n\t\tmenuItems := lo.Map(confPaths, func(path string, _ int) *types.MenuItem {\n\t\t\treturn &types.MenuItem{\n\t\t\t\tLabel: path,\n\t\t\t\tOnPress: func() error {\n\t\t\t\t\treturn self.c.Helpers().Files.EditFiles([]string{path})\n\t\t\t\t},\n\t\t\t}\n\t\t})\n\n\t\treturn self.c.Menu(types.CreateMenuOptions{\n\t\t\tTitle: self.c.Tr.SelectConfigFile,\n\t\t\tItems: menuItems,\n\t\t})\n\t}\n}","sourceCodeStart":1,"sourceCodeEnd":36,"githubUrl":"https://github.com/jesseduffield/lazygit/blob/c477a2959b229fbf3284be0d4d2904ab61ec3c94/pkg/gui/controllers/edit_config_action.go#L1-L36","documentation":"Thrown by EditConfigAction.Call when GetUserConfigPaths() returns an empty list — lazygit found no config file anywhere in its search paths (neither the default ~/.config/lazygit/config.yml nor any custom path from LG_CONFIG_FILE). Since the action's whole purpose is to open the config for editing, there is nothing to open and it errors instead.","triggerScenarios":"Pressing the 'open config file' key (typically 'o' from the options/global menu or ':edit-config') on a machine where lazygit has never written a config file and none exists at the default locations.","commonSituations":"First run on a fresh install, XDG_CONFIG_HOME pointing somewhere unusual so the default path was never created, or a portable/embedded environment with no writable config dir.","solutions":["Create the default config: 'mkdir -p ~/.config/lazygit && touch ~/.config/lazygit/config.yml', then retry","Or set LG_CONFIG_FILE to a path of your choice and create that file","Run lazygit once so it can write default config/state directories, then retry the action"],"exampleFix":"# before: no config exists, edit-config errors\n# after\nmkdir -p ~/.config/lazygit\ntouch ~/.config/lazygit/config.yml","handlingStrategy":"validation","validationCode":"// Ensure a config path exists before offering to edit it:\nif len(getUserConfigPaths()) == 0 {\n    return errors.New(\"create ~/.config/lazygit/config.yml first\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Ship/create a default config file at install time","In wrappers, pre-create the XDG path before launching lazygit","Set LG_CONFIG_FILE explicitly in scripted environments"],"tags":["lazygit","config","xdg","first-run"],"backgroundTag":null,"analyzedSha":"c477a2959b229fbf3284be0d4d2904ab61ec3c94","analyzedAt":"2026-08-15T08:34:32.451Z","schemaVersion":2},"datasetVersion":"2026-08-16T03:17:38.424Z"}