diff --git a/esphome/cli/rotate_key.py b/esphome/cli/rotate_key.py index 88adc2271c..877aa62192 100644 --- a/esphome/cli/rotate_key.py +++ b/esphome/cli/rotate_key.py @@ -249,9 +249,9 @@ def _restore(originals: dict[Path, Snapshot], keys: str) -> None: try: restore_files(originals) except (EsphomeError, KeyboardInterrupt) as err: - safe_print( - color(AnsiFore.BOLD_RED, str(err) or f"Interrupted restoring {files}") - ) + # An interrupted restore carries its report as a note + why = str(err) or "; ".join(getattr(err, "__notes__", ())) + safe_print(color(AnsiFore.BOLD_RED, why or f"Interrupted restoring {files}")) safe_print(keys) else: safe_print(color(AnsiFore.BOLD_YELLOW, f"Restored the previous key in {files}"))