jesseduffield/lazygit · error

Unexpected value ' ' for ' '. Allowed values

Error message

Unexpected value '%s' for '%s'. Allowed values: %s

What it means

Generic enum validator in pkg/config/user_config_validation.go: validateEnum(name, value, allowedValues) returns this error when a config string field does not match any allowed value. It is the shared backstop for several enum-ish user config options (e.g. git.log config values, custom command output modes such as '', none, terminal, log, logWithPty, popup).

Solutions

  1. Read the allowed values listed in the error message and set the field to one of them exactly.
  2. Check casing — matching is exact string equality, not case-insensitive.
  3. If you believe the value should be valid, check the field's allowed list in user_config_validation.go for your lazygit version.

Example fix

# before
customCommands:
  - key: 'a'
    command: make test
    output: window

# after
customCommands:
  - key: 'a'
    command: make test
    output: popup
Defensive patterns

Strategy: validation

Validate before calling

func inEnum(v string, allowed ...string) bool {
	for _, a := range allowed {
		if v == a {
			return true
		}
	}
	return false
}

Prevention

When it happens

Trigger: Any config field validated via validateEnum receiving a value outside its allowed list — e.g. customCommands output 'window' instead of 'popup', or a v.value like 'menu' for a field that only permits a fixed set.

Common situations: Typos or casing differences in enum-valued config keys; values valid in older lazygit versions that were renamed; hand-written configs instead of copying from docs.

Related errors


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

Appendix: source

Thrown at pkg/config/user_config_validation.go:143

				return errors.New("git.diffRenderers: 'args' cannot be used with diff renderer type 'extDiff'.")
			}
		case "rawGit":
			if diffRenderer.Command != "" {
				return errors.New("git.diffRenderers: 'command' cannot be used with diff renderer type 'rawGit'.")
			}
		default:
			return fmt.Errorf("git.diffRenderers: unknown type '%s'. Allowed values: stdinFilter, extDiff, rawGit", diffRenderer.Type)
		}
	}
	return nil
}

func validateEnum(name string, value string, allowedValues []string) error {
	if slices.Contains(allowedValues, value) {
		return nil
	}
	allowedValuesStr := strings.Join(allowedValues, ", ")
	return fmt.Errorf("Unexpected value '%s' for '%s'. Allowed values: %s", value, name, allowedValuesStr)
}

func validateKeybindingsRecurse(path string, node any) error {
	value := reflect.ValueOf(node)
	if value.Kind() == reflect.Struct {
		for _, field := range reflect.VisibleFields(reflect.TypeOf(node)) {
			var newPath string
			if len(path) == 0 {
				newPath = field.Name
			} else {
				newPath = fmt.Sprintf("%s.%s", path, field.Name)
			}
			if err := validateKeybindingsRecurse(newPath,
				value.FieldByName(field.Name).Interface()); err != nil {
				return err
			}
		}
	} else if value.Kind() == reflect.Slice {

View on GitHub (pinned to c477a2959b)