Skip to content

Validate the context names in the "context" field of custom commands - #5989

Merged
stefanhaller merged 1 commit into
masterfrom
validate-custom-command-contexts
Sep 3, 2026
Merged

stefanhaller merged 1 commit into
masterfrom
validate-custom-command-contexts

Conversation

@stefanhaller

Copy link
Copy Markdown
Collaborator

If a custom command's "context" field contains a context name that doesn't exist, lazygit panics when building the keybindings. This could happen either because of a typo, or because a context is removed or renamed in a later version. Prevent the panic by validating those names at config load time, and rejecting the config as invalid there, like we do for other config errors.

If a custom command's "context" field contains a context name that
doesn't exist, lazygit panics when building the keybindings. This could
happen either because of a typo, or because a context is removed or
renamed in a later version. Prevent the panic by validating those names
at config load time, and rejecting the config as invalid there, like we
do for other config errors.

The gui package owns the list, but can't be imported from here, so it is
mirrored and a test over there ensures the copies stay in sync.

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
@stefanhaller stefanhaller added the bug Something isn't working label Sep 3, 2026
@stefanhaller
stefanhaller merged commit e7de683 into master Sep 3, 2026
14 checks passed
@stefanhaller
stefanhaller deleted the validate-custom-command-contexts branch September 3, 2026 19:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant