diff --git a/esphome/components/mapping/mapping.h b/esphome/components/mapping/mapping.h index 1e4f7858aae..ef20a173b7b 100644 --- a/esphome/components/mapping/mapping.h +++ b/esphome/components/mapping/mapping.h @@ -66,8 +66,8 @@ template class Mapping { } esph_log_e(TAG, "Key '%s' not found in mapping", buf); } else { - // Fallback for custom types - likely unreachable but kept for compatibility - esph_log_e(TAG, "Key '%s' not found in mapping", to_string(key).c_str()); + // All supported key types are handled above - this should never be reached + static_assert(sizeof(K) == 0, "Unsupported key type for Mapping error logging"); } return {}; }