Repository navigation
Description
Describe what happened
Since v4.30.0, a helm.v3.Release whose values contain a null inside an array element crashes the provider on the next update that changes anything else in that array element:
error: Detected that /root/.pulumi/plugins/resource-kubernetes-v4.30.0/pulumi-resource-kubernetes exited prematurely.
This is *always* a bug in the provider. Please report the issue to the provider author as appropriate.
To assist with debugging we have dumped the STDOUT and STDERR streams of the plugin:panic: fatal: An assertion has failed: path: [values mm5 hosts 0 apiBaseUrl] | v: <nil> | old: <nil> | oldInput: <nil> | newInput: <nil> [recovered, repanicked]
goroutine 222 [running]:
go.opentelemetry.io/otel/sdk/trace.(*recordingSpan).End.deferwrap1()
/home/runner/go/pkg/mod/go.opentelemetry.io/otel/sdk@v1.43.0/trace/span.go:478 +0x1b
go.opentelemetry.io/otel/sdk/trace.(*recordingSpan).End(0x2c224b9945a0, {0x0, 0x0, 0x2c22478401e0?})
/home/runner/go/pkg/mod/go.opentelemetry.io/otel/sdk@v1.43.0/trace/span.go:528 +0xc7b
panic({0x4068a00?, 0x2c224c3dc960?})
/home/runner/.local/share/mise/installs/go/1.26.0/src/runtime/panic.go:860 +0x13a
github.com/pulumi/pulumi/sdk/v3/go/common/util/contract.failfast(...)
/home/runner/go/pkg/mod/github.com/pulumi/pulumi/sdk/v3@v3.228.0/go/common/util/contract/failfast.go:23
github.com/pulumi/pulumi/sdk/v3/go/common/util/contract.Assertf(0x0?, {0x541d797?, 0x8?}, {0x2c224bb45ec0?, 0x1?, 0x1?})
/home/runner/go/pkg/mod/github.com/pulumi/pulumi/sdk/v3@v3.228.0/go/common/util/contract/assert.go:35 +0xe8
github.com/pulumi/pulumi-kubernetes/provider/v4/pkg/provider.(*patchConverter).addPatchValueToDiff(0x2c224bb46b40, {0x2c224c33ac00, 0x5, 0x8}, {0x0, 0x0}, {0x0, 0x0}, {0x0, 0x0}, ...)
/home/runner/work/pulumi-kubernetes/pulumi-kubernetes/provider/pkg/provider/provider.go:2989 +0x1aa
github.com/pulumi/pulumi-kubernetes/provider/v4/pkg/provider.(*patchConverter).addPatchMapToDiff(0x2c224bb46b40, {0x2c224c37aa80, 0x4, 0x4}, 0x2c224c333bf0, 0x2c224c3b03c0, 0x2c224c3c45d0, 0x2c224c3d67e0, 0x1)
/home/runner/work/pulumi-kubernetes/pulumi-kubernetes/provider/pkg/provider/provider.go:3101 +0x310
github.com/pulumi/pulumi-kubernetes/provider/v4/pkg/provider.(*patchConverter).addPatchValueToDiff(0x2c224bb46b40, {0x2c224c37aa80, 0x4, 0x4}, {0x45f13e0, 0x2c224c333bf0}, {0x45f13e0, 0x2c224c3b03c0}, {0x45f13e0, 0x2c224c3c45d0}, ...)
/home/runner/work/pulumi-kubernetes/pulumi-kubernetes/provider/pkg/provider/provider.go:3021 +0x3db
github.com/pulumi/pulumi-kubernetes/provider/v4/pkg/provider.(*patchConverter).addPatchArrayToDiff(0x2c224bb46b40, {0x2c224c37aa80, 0x3, 0x4}, {0x2c224c31d4f0, 0x1, 0x426fbe?}, {0x2c224c3ac960, 0x1, 0x1}, ...)
/home/runner/work/pulumi-kubernetes/pulumi-kubernetes/provider/pkg/provider/provider.go:3135 +0x225
github.com/pulumi/pulumi-kubernetes/provider/v4/pkg/provider.(*patchConverter).addPatchValueToDiff(0x2c224bb46b40, {0x2c224c37aa80, 0x3, 0x4}, {0x3f3ea00, 0x2c224c290d68}, {0x3f3ea00, 0x2c224c3aa4f8}, {0x3f3ea00, 0x2c224c3ab5d8}, ...)
/home/runner/work/pulumi-kubernetes/pulumi-kubernetes/provider/pkg/provider/provider.go:3028 +0x4fd
github.com/pulumi/pulumi-kubernetes/provider/v4/pkg/provider.(*patchConverter).addPatchMapToDiff(0x2c224bb46b40, {0x2c224c3cf420, 0x2, 0x2}, 0x2c224c333bc0, 0x2c224c3b0300, 0x2c224c3c4510, 0x2c224c3d6720, 0x0)
/home/runner/work/pulumi-kubernetes/pulumi-kubernetes/provider/pkg/provider/provider.go:3101 +0x310
github.com/pulumi/pulumi-kubernetes/provider/v4/pkg/provider.(*patchConverter).addPatchValueToDiff(0x2c224bb46b40, {0x2c224c3cf420, 0x2, 0x2}, {0x45f13e0, 0x2c224c333bc0}, {0x45f13e0, 0x2c224c3b0300}, {0x45f13e0, 0x2c224c3c4510}, ...)
/home/runner/work/pulumi-kubernetes/pulumi-kubernetes/provider/pkg/provider/provider.go:3021 +0x3db
github.com/pulumi/pulumi-kubernetes/provider/v4/pkg/provider.(*patchConverter).addPatchMapToDiff(0x2c224bb46b40, {0x2c224c3dc6a0, 0x1, 0x1}, 0x2c224c333b90, 0x2c224c39a660, 0x2c224c3b0870, 0x2c224c3c4a80, 0x0)
/home/runner/work/pulumi-kubernetes/pulumi-kubernetes/provider/pkg/provider/provider.go:3101 +0x310
github.com/pulumi/pulumi-kubernetes/provider/v4/pkg/provider.(*patchConverter).addPatchValueToDiff(0x2c224bb46b40, {0x2c224c3dc6a0, 0x1, 0x1}, {0x45f13e0, 0x2c224c333b90}, {0x45f13e0, 0x2c224c39a660}, {0x45f13e0, 0x2c224c3b0870}, ...)
/home/runner/work/pulumi-kubernetes/pulumi-kubernetes/provider/pkg/provider/provider.go:3021 +0x3db
github.com/pulumi/pulumi-kubernetes/provider/v4/pkg/provider.(*patchConverter).addPatchMapToDiff(0x2c224bb46b40, {0x0, 0x0, 0x0}, 0x2c224c333b60, 0x2c224c3823c0, 0x2c224c3b0840, 0x2c224c3c4a50, 0x0)
/home/runner/work/pulumi-kubernetes/pulumi-kubernetes/provider/pkg/provider/provider.go:3101 +0x310
github.com/pulumi/pulumi-kubernetes/provider/v4/pkg/provider.convertPatchToDiff(0x2c224c333b60, 0x2c224c3823c0, 0x2c224c3b0840, 0x2c224c3c4a50, {0x2c224c3860e0, 0x2, 0x2})
/home/runner/work/pulumi-kubernetes/pulumi-kubernetes/provider/pkg/provider/provider.go:2906 +0x131
github.com/pulumi/pulumi-kubernetes/provider/v4/pkg/provider.(*helmReleaseProvider).Diff(0x2c224b6223c0?, {0x29?, 0x0?}, 0x2c224b657720)
/home/runner/work/pulumi-kubernetes/pulumi-kubernetes/provider/pkg/provider/helm_release.go:837 +0x133e
github.com/pulumi/pulumi-kubernetes/provider/v4/pkg/provider.(*kubeProvider).Diff(0x2c224762ec40, {0x561d650, 0x2c224bfce2a0}, 0x2c224b657720)
/home/runner/work/pulumi-kubernetes/pulumi-kubernetes/provider/pkg/provider/provider.go:1405 +0xf75
github.com/pulumi/pulumi/sdk/v3/proto/go._ResourceProvider_Diff_Handler.func1({0x561d650?, 0x2c224bfce2a0?}, {0x4c37680?, 0x2c224b657720?})
/home/runner/go/pkg/mod/github.com/pulumi/pulumi/sdk/v3@v3.228.0/proto/go/provider_grpc.pb.go:933 +0xcb
github.com/pulumi/pulumi/pkg/v3/resource/provider.MainContext.func1({0x561d650, 0x2c224bfce240}, {0x4c37680, 0x2c224b657720}, 0x2c224b5d4c00?, 0x2c224bb002a0)
/home/runner/go/pkg/mod/github.com/pulumi/pulumi/pkg/v3@v3.228.0/resource/provider/main.go:84 +0x1d4
google.golang.org/grpc.getChainUnaryHandler.func1.getChainUnaryHandler.1({0x561d650, 0x2c224bfce240}, {0x4c37680, 0x2c224b657720})
/home/runner/go/pkg/mod/google.golang.org/grpc@v1.80.0/server.go:1243 +0xa8
github.com/pulumi/pulumi/sdk/v3/go/common/util/rpcutil.OTelServerInterceptorOptions.stackTraceUnaryServerInterceptor.func2({0x561d650, 0x2c224bfce240}, {0x4c37680, 0x2c224b657720}, 0x0?, 0x2c224bfcdac0)
/home/runner/go/pkg/mod/github.com/pulumi/pulumi/sdk/v3@v3.228.0/go/common/util/rpcutil/interceptor.go:301 +0x20f
google.golang.org/grpc.getChainUnaryHandler.func1({0x561d650?, 0x2c224bfce240?}, {0x4c37680?, 0x2c224b657720?})
/home/runner/go/pkg/mod/google.golang.org/grpc@v1.80.0/server.go:1243 +0x153
github.com/pulumi/pulumi/sdk/v3/go/common/util/rpcutil.OTelServerInterceptorOptions.otelUnaryServerInterceptor.func1({0x561d650?, 0x2c224bae5620?}, {0x4c37680, 0x2c224b657720}, 0x2c224bae3840, 0x2c224bfcda80)
/home/runner/go/pkg/mod/github.com/pulumi/pulumi/sdk/v3@v3.228.0/go/common/util/rpcutil/interceptor.go:228 +0xdf
google.golang.org/grpc.NewServer.chainUnaryServerInterceptors.chainUnaryInterceptors.func1({0x561d650, 0x2c224bae5620}, {0x4c37680, 0x2c224b657720}, 0x2c224bae3840, 0x78?)
/home/runner/go/pkg/mod/google.golang.org/grpc@v1.80.0/server.go:1234 +0x7c
github.com/pulumi/pulumi/sdk/v3/proto/go._ResourceProvider_Diff_Handler({0x52cf860, 0x2c224762ec40}, {0x561d650, 0x2c224bae5620}, 0x2c224ba5f080, 0x2c2246f4d460)
/home/runner/go/pkg/mod/github.com/pulumi/pulumi/sdk/v3@v3.228.0/proto/go/provider_grpc.pb.go:935 +0x143
google.golang.org/grpc.(*Server).processUnaryRPC(0x2c2247132248, {0x561d650, 0x2c224bae5590}, 0x2c224b7e36c0, 0x2c224782dc80, 0xab446f8, 0x0)
/home/runner/go/pkg/mod/google.golang.org/grpc@v1.80.0/server.go:1430 +0x11d2
google.golang.org/grpc.(*Server).handleStream(0x2c2247132248, {0x5623718, 0x2c224781cea0}, 0x2c224b7e36c0)
/home/runner/go/pkg/mod/google.golang.org/grpc@v1.80.0/server.go:1856 +0xbc6
google.golang.org/grpc.(*Server).serveStreams.func2.1()
/home/runner/go/pkg/mod/google.golang.org/grpc@v1.80.0/server.go:1065 +0x7f
created by google.golang.org/grpc.(*Server).serveStreams.func2 in goroutine 83
/home/runner/go/pkg/mod/google.golang.org/grpc@v1.80.0/server.go:1076 +0x11d
In our chart the array is values.mm5.hosts; the unit test below uses a top-level hosts array, which reproduces the same panic.
The steps that trigger it:
- Deploy a release with values like
hosts: [{ apiBaseUrl: null, enabledFeatures: [] }]. This succeeds, and thenullis stored in state. - Change something else in that element, for example
enabledFeatures: ["workspaces"], keepingapiBaseUrl: null. pulumi preview/pulumi upcrashes inDiff. Every retry crashes the same way, so the stack can't be updated until the program changes.
What happens:
- The three-way merge patch replaces the whole changed array (
noSchema), soaddPatchArrayToDiff→addPatchMapToDiffwalks every key of the element. - For
apiBaseUrl, the patch value, old state, old input and new input are allnil, so the assertion at the top ofaddPatchValueToDifffails:
contract.Assertf(v != nil || old != nil || oldInput != nil || newInput != nil, ...)Before #4293 ("Don't skip nulls when unmarshaling", first released in v4.30.0) these nulls were dropped on unmarshal, so the key was missing rather than nil and the assertion held. Now that nulls are preserved, as intended, an unchanged null can reach this assertion. The function's doc comment already describes the expected behaviour: "If the old and patched values are both nil or missing, no diff is recorded."
Sample program
A unit test that reproduces it at master (acec63d5, after v4.35.0) without a cluster. It calls helmReleaseProvider.Diff with olds/news marshalled as the engine sends them (nulls kept). Save it as provider/pkg/provider/helm_release_diff_test.go and run:
cd provider && go test ./pkg/provider/ -run TestHelmReleaseDiff_ -v
TestHelmReleaseDiff_NullValueInChangedArrayElement fails with the panic above. TestHelmReleaseDiff_NonNullValueInChangedArrayElement is the same change with "" instead of null, and passes.
helm_release_diff_test.go
// Copyright 2016-2026, Pulumi Corporation.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package provider
import (
"context"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
structpb "google.golang.org/protobuf/types/known/structpb"
"github.com/pulumi/pulumi/sdk/v3/go/common/resource"
"github.com/pulumi/pulumi/sdk/v3/go/common/resource/plugin"
pulumirpc "github.com/pulumi/pulumi/sdk/v3/proto/go"
)
// A Helm value that is null in both the old and the new inputs, inside an array element that changed for
// another reason. The patch replaces the whole array, so the diff walks every key of the element, and the
// unchanged null key must not trip the assertion in addPatchValueToDiff.
func TestHelmReleaseDiff_NullValueInChangedArrayElement(t *testing.T) {
oldValues := hostsValues(resource.NewNullProperty(), []string{})
newValues := hostsValues(resource.NewNullProperty(), []string{"workspaces"})
var resp *pulumirpc.DiffResponse
require.NotPanics(t, func() {
var err error
resp, err = diffHelmReleaseValues(t, oldValues, newValues)
require.NoError(t, err)
})
assert.Equal(t, pulumirpc.DiffResponse_DIFF_SOME, resp.GetChanges())
assert.Contains(t, resp.GetDetailedDiff(), "values.hosts[0].enabledFeatures[0]")
assert.NotContains(t, resp.GetDetailedDiff(), "values.hosts[0].apiBaseUrl")
}
// The same change with a non-null value in place of the null diffs fine.
func TestHelmReleaseDiff_NonNullValueInChangedArrayElement(t *testing.T) {
oldValues := hostsValues(resource.NewStringProperty(""), []string{})
newValues := hostsValues(resource.NewStringProperty(""), []string{"workspaces"})
resp, err := diffHelmReleaseValues(t, oldValues, newValues)
require.NoError(t, err)
assert.Equal(t, pulumirpc.DiffResponse_DIFF_SOME, resp.GetChanges())
assert.Contains(t, resp.GetDetailedDiff(), "values.hosts[0].enabledFeatures[0]")
}
func hostsValues(apiBaseURL resource.PropertyValue, enabledFeatures []string) resource.PropertyValue {
features := make([]resource.PropertyValue, 0, len(enabledFeatures))
for _, f := range enabledFeatures {
features = append(features, resource.NewStringProperty(f))
}
return resource.NewObjectProperty(resource.PropertyMap{
"hosts": resource.NewArrayProperty([]resource.PropertyValue{
resource.NewObjectProperty(resource.PropertyMap{
"apiBaseUrl": apiBaseURL,
"enabledFeatures": resource.NewArrayProperty(features),
}),
}),
})
}
// diffHelmReleaseValues diffs a release whose previous deployment used oldValues against new inputs using
// newValues, marshalled over the wire as the engine sends them (nulls kept).
func diffHelmReleaseValues(
t *testing.T, oldValues, newValues resource.PropertyValue,
) (*pulumirpc.DiffResponse, error) {
t.Helper()
release := func(values resource.PropertyValue) resource.PropertyMap {
return resource.PropertyMap{
"chart": resource.NewStringProperty("example"),
"name": resource.NewStringProperty("example"),
"namespace": resource.NewStringProperty("default"),
"values": values,
}
}
olds := release(oldValues)
olds["__inputs"] = resource.MakeSecret(resource.NewObjectProperty(release(oldValues)))
news := release(newValues)
marshal := func(label string, props resource.PropertyMap) *structpb.Struct {
s, err := plugin.MarshalProperties(props, plugin.MarshalOptions{
Label: label, KeepUnknowns: true, KeepSecrets: true,
})
require.NoError(t, err)
return s
}
p := &helmReleaseProvider{name: "test"}
return p.Diff(context.Background(), &pulumirpc.DiffRequest{
Urn: "urn:pulumi:test::test::kubernetes:helm.sh/v3:Release::example",
Olds: marshal("olds", olds),
News: marshal("news", news),
})
}Suggested fix
Treat a value that is nil in all four places as unchanged, as the doc comment says, instead of asserting. With this change both tests pass, and the rest of ./pkg/provider/ still passes:
func (pc *patchConverter) addPatchValueToDiff(
path []any, v, old, newInput, oldInput any, inArray bool,
) error {
- contract.Assertf(v != nil || old != nil || oldInput != nil || newInput != nil,
- "path: %+v | v: %+v | old: %+v | oldInput: %+v | newInput: %+v",
- path, v, old, oldInput, newInput)
+ // A value that is null everywhere is unchanged. Null values are preserved in Helm release values, so this is
+ // reachable when a patch replaces a whole array whose elements contain an unchanged null.
+ if v == nil && old == nil && oldInput == nil && newInput == nil {
+ return nil
+ }I'm happy to open a PR with the test and this change.
Log output
The panic and stack trace are above. The unit test reproduces it without a cluster, so I haven't attached -v=10 logs.
Affected Resource(s)
kubernetes:helm.sh/v3:Release
Output of pulumi about
- pulumi-kubernetes: v4.30.0 (where we hit it); reproduced by the unit test at
masteracec63d5 - Pulumi CLI: 3.268.0
- Language: .NET (Automation API, inline program); the test above doesn't depend on the language
Additional context
Workaround: don't send null in Helm values (we send "", which our chart treats as unset). Related: #2997 and #4293 (null preservation), which made this assertion reachable.
Activity
guineveresaenger commentedon Dec 2, 2026
hi @zlepper thanks for finding this. We'd be happy for you to submit the change and test. Thank you very much for asking. 🙇♀️
zlepper commentedon Dec 2, 2026
PR #4737 submitted now :)