From 29002c8f45f69a9caf0887d3de07b9db67149f0d Mon Sep 17 00:00:00 2001 From: Clyde Stubbs <2366188+clydebarrow@users.noreply.github.com> Date: Wed, 13 Dec 2023 10:38:37 +1100 Subject: [PATCH] Fix crash when handling pin_check error (#5915) --- esphome/config.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/esphome/config.py b/esphome/config.py index 3461223490..745883c2ef 100644 --- a/esphome/config.py +++ b/esphome/config.py @@ -111,7 +111,12 @@ class Config(OrderedDict, fv.FinalValidateConfig): last_root = max( i for i, v in enumerate(error.path) if v is cv.ROOT_CONFIG_PATH ) - error.path = error.path[last_root + 1 :] + # can't change the path so re-create the error + error = vol.Invalid( + message=error.error_message, + path=error.path[last_root + 1 :], + error_type=error.error_type, + ) self.errors.append(error) def add_validation_step(self, step: "ConfigValidationStep"):