From cb602c463807c3b23f41e6cfbfe72c83592a7453 Mon Sep 17 00:00:00 2001 From: Md_Mushfiqur Rahim <20mahin20201@gmail.com> Date: Tue, 26 May 2026 12:19:20 +0000 Subject: [PATCH] fix: fall back to default kube version when build info is unavailable When Helm is compiled with toolchains other than go build (e.g. Bazel), debug.ReadBuildInfo() returns false, causing a panic during DefaultCapabilities initialization. Fall back to the default Kubernetes version (v1.20.0) instead of panicking. Signed-off-by: MD-Mushfiqur123 --- pkg/chart/common/capabilities.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/chart/common/capabilities.go b/pkg/chart/common/capabilities.go index 20f4953cf..060b54f4e 100644 --- a/pkg/chart/common/capabilities.go +++ b/pkg/chart/common/capabilities.go @@ -17,6 +17,7 @@ package common import ( "fmt" + "log/slog" "slices" "strconv" "strings" @@ -152,7 +153,10 @@ func makeDefaultCapabilities() (*Capabilities, error) { vstr, err := helmversion.K8sIOClientGoModVersion() if err != nil { - return nil, fmt.Errorf("failed to retrieve k8s.io/client-go version: %w", err) + // Build info may be unavailable when compiled with toolchains other + // than "go build" (e.g. Bazel). Fall back to a safe default. + slog.Warn("failed to retrieve k8s.io/client-go version, falling back to default Kubernetes version", slog.Any("error", err)) + return newCapabilities(1, 20) } v, err := semver.NewVersion(vstr)