jesseduffield/lazygit · info

No config file found

Error message

No config file found

What it means

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.

Source

Thrown at pkg/gui/controllers/edit_config_action.go:18

package controllers

import (
	"errors"

	"github.com/jesseduffield/lazygit/pkg/gui/types"
	"github.com/samber/lo"
)

type EditConfigAction struct {
	c *ControllerCommon
}

func (self *EditConfigAction) Call() error {
	confPaths := self.c.GetConfig().GetUserConfigPaths()
	switch len(confPaths) {
	case 0:
		return errors.New(self.c.Tr.NoConfigFileFoundErr)
	case 1:
		return self.c.Helpers().Files.EditFiles(confPaths)
	default:
		menuItems := lo.Map(confPaths, func(path string, _ int) *types.MenuItem {
			return &types.MenuItem{
				Label: path,
				OnPress: func() error {
					return self.c.Helpers().Files.EditFiles([]string{path})
				},
			}
		})

		return self.c.Menu(types.CreateMenuOptions{
			Title: self.c.Tr.SelectConfigFile,
			Items: menuItems,
		})
	}
}

View on GitHub (pinned to c477a2959b)

Solutions

  1. Create the default config: 'mkdir -p ~/.config/lazygit && touch ~/.config/lazygit/config.yml', then retry
  2. Or set LG_CONFIG_FILE to a path of your choice and create that file
  3. Run lazygit once so it can write default config/state directories, then retry the action

Example fix

# before: no config exists, edit-config errors
# after
mkdir -p ~/.config/lazygit
touch ~/.config/lazygit/config.yml
Defensive patterns

Strategy: validation

Validate before calling

// Ensure a config path exists before offering to edit it:
if len(getUserConfigPaths()) == 0 {
    return errors.New("create ~/.config/lazygit/config.yml first")
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of jesseduffield/lazygit@c477a2959b (2026-08-15). Data as JSON: /api/errors/2a563d2f9792984a. Report an issue: GitHub.