From b6fb11e454e02b03fdada9e38c90b5d6bb71b4f2 Mon Sep 17 00:00:00 2001 From: kakao-mark-yun Date: Fri, 31 Jan 2025 17:49:10 +0900 Subject: [PATCH] fix: prevent panic on partial append failures During partial append failures, the error field was incorrectly accessed from a nil err variable instead of the result struct, causing a nil pointer dereference panic. Change err.Error() to res[idx].Error to properly handle error messages in partial failure cases. --- pkg/varlog/operations.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/varlog/operations.go b/pkg/varlog/operations.go index 5e41f939a..1d7495417 100644 --- a/pkg/varlog/operations.go +++ b/pkg/varlog/operations.go @@ -74,7 +74,7 @@ RETRY: for idx := 0; idx < len(res); idx++ { if len(res[idx].Error) > 0 { - if strings.Contains(err.Error(), "sealed") { + if strings.Contains(res[idx].Error, "sealed") { result.Err = fmt.Errorf("append: %s: %w", res[idx].Error, verrors.ErrSealed) } else { result.Err = fmt.Errorf("append: %s", res[idx].Error)