diff --git a/src/click/exceptions.py b/src/click/exceptions.py index 4d782ee361..e2add54ed5 100644 --- a/src/click/exceptions.py +++ b/src/click/exceptions.py @@ -78,8 +78,9 @@ def show(self, file: t.IO[t.Any] | None = None) -> None: self.ctx is not None and self.ctx.command.get_help_option(self.ctx) is not None ): + help_names = self.ctx.command.get_help_option_names(self.ctx) hint = _("Try '{command} {option}' for help.").format( - command=self.ctx.command_path, option=self.ctx.help_option_names[0] + command=self.ctx.command_path, option=help_names[0] ) hint = f"{hint}\n" if self.ctx is not None: