jesseduffield/lazygit · info
{{disabledReason.Text}}
Error message
{{disabledReason.Text}} What it means
Returned when a keybinding's GetDisabledReason callback produces a DisabledReason with ShowErrorInPanel set, meaning the action is unavailable and the reason must be surfaced in the error panel rather than as a toast. callKeybindingHandler converts disabledReason.Text into a plain errors.New value instead of running binding.Handler. It is lazygit's way of saying 'this key is bound but not usable in the current context'.
Source
Thrown at pkg/gui/keybindings.go:406
for _, key := range binding.Keys {
gui.g.SetKeybinding(binding.ViewName, key, handler)
}
}
func (gui *Gui) SetMouseKeybinding(binding *gocui.ViewMouseBinding) error {
return gui.g.SetViewClickBinding(binding)
}
func (gui *Gui) callKeybindingHandler(binding *types.Binding) error {
if binding.GetDisabledReason != nil {
if disabledReason := binding.GetDisabledReason(); disabledReason != nil {
if disabledReason.AllowFurtherDispatching {
return &types.ErrKeybindingNotHandled{DisabledReason: disabledReason}
}
if disabledReason.ShowErrorInPanel {
return errors.New(disabledReason.Text)
}
if len(disabledReason.Text) > 0 {
gui.c.ErrorToast(gui.Tr.DisabledMenuItemPrefix + disabledReason.Text)
}
return nil
}
}
return binding.Handler()
}
View on GitHub (pinned to c477a2959b)
Solutions
- Read the error text: it names exactly why the action is disabled (e.g. 'cannot X in this context'); fix that precondition first.
- Check the current view's selection/state that the keybinding's GetDisabledReason checks in pkg/gui/controllers/
- If the keybinding comes from user config (custom keybinding), verify it isn't bound to a context where its handler is invalid.
- If you believe the action should be available, file an issue: the disabled-reason guard may be too strict for your state.
Defensive patterns
Strategy: validation
Validate before calling
// Before invoking an action programmatically, check whether its binding is disabled:
if binding.GetDisabledReason != nil {
if reason := binding.GetDisabledReason(); reason != nil {
// skip / show reason.Text; do not call the handler
return reason.Text
}
}
return binding.Handler() Prevention
- Treat disabled-reason errors as expected control flow, not failures; match on the DisabledReason before invoking handlers.
- When adding custom keybindings, test them in each view/context where they may fire.
- UI code should render DisabledReason.Text via toasts/panel instead of generic error handling.
When it happens
Trigger: Pressing a key whose binding is disabled in the current view state where the disabled reason explicitly requests panel display (ShowErrorInPanel=true), e.g. acting on a worktree/branch/submodule that does not support the operation. Also produced when AllowFurtherDispatching is false and ShowErrorInPanel is true on the returned DisabledReason.
Common situations: Pressing a shortcut in a view where the selection type doesn't support it (e.g. delete on a special branch), or a plugin/custom command binding whose disabled condition now triggers after a state change.
Related errors
- Error when setting custom command keybindings: unknown conte
- Error parsing custom command keybindings: context not provid
- gui.sidePanels: a side panel must have at least one tab.
- gui.sidePanels must not be empty.
- Cannot change context while in patch building mode because w
AI-assisted analysis of jesseduffield/lazygit@c477a2959b (2026-08-15).
Data as JSON: /api/errors/b6349c2b86ca8f5e.
Report an issue: GitHub.