A pipeline that has run helm upgrade --install --force for six years starts failing on Helm 4 with invalid operation: cannot use server-side apply and force replace together, and nobody touched the command. This walks through why the same binary and the same chart fail on one release and pass on another, and which of three fixes matches what you actually wanted --force to do.
The short version
--force was not removed in Helm 4. It is a deprecated alias for --force-replace, registered in pkg/cmd/upgrade.go, which is why it still parses but no longer appears in helm upgrade --help. Helm 4 also applies new releases server-side by default, and server-side apply plus replace is rejected by the client update validator in pkg/kube/client.go. The field that decides which way your run goes is stored on the previous release, and one command prints it:
helm get metadata ssa-demo | grep APPLY_METHOD
What you need on the box
- Helm 4.3.2 (
helm version --short). Everything below is read out of Helm'smainbranch source, so no prerelease is involved. kubectl1.30+,jq, and a cluster you can install a throwaway chart into. kind or k3d is enough.- Kubernetes 1.18 or newer for
managedFieldsto exist at all. Helm's own comment inpkg/kube/client.gonotes managed fields were first introduced in 1.18. - Namespace-scoped install and upgrade rights. No cluster-admin needed.
- You should know what
helm upgradedoes. Server-side apply and field ownership get explained where they matter.
Reproduce it twice, changing only how the release was installed
helm create demo
helm install ssa-demo ./demo
helm install csa-demo ./demo --server-side=false
helm install --server-side is a boolean defaulting to true, while helm upgrade --server-side is a string defaulting to auto (helm_upgrade reference). That asymmetry between the two commands is easy to miss when reading the docs side by side. So ssa-demo is applied server-side and csa-demo is not. Now run the identical legacy command against both:
helm upgrade ssa-demo ./demo --force # fails
helm upgrade csa-demo ./demo --force # succeeds, with a deprecation notice
The only variable is the install method, which is what makes this so confusing in a fleet: it looks like a flaky chart, the way containerd 1.x suddenly stopping a kubelet from joining looks like a node problem before you find the version floor. The failing run surfaces two nested clauses under Helm's usual Error: UPGRADE FAILED: prefix, both verifiable verbatim in pkg/kube/client.go:
invalid client update option(s): invalid operation: cannot use server-side apply and force replace together
Grep for the inner clause, not the outer one. The outer wrapper is shared with other option conflicts.
Which flag did you actually pass? --force is still there, just hidden
In pkg/cmd/upgrade.go the registration is two lines:
f.BoolVar(&client.ForceReplace, "force", false, "deprecated")
f.MarkDeprecated("force", "use --force-replace instead")
It binds to the same ForceReplace field as --force-replace. Cobra hides deprecated flags from help, so helm upgrade --help and the published flag reference list only --force-replace while your six-year-old command keeps working. An assistant trained on Helm 3 will tell you --force recreates resources; an assistant reading helm.sh will tell you --force does not exist. Neither answer gets you to a green job. --atomic is wired identically, aliasing RollbackOnFailure, and the pattern is the same one that makes removed-but-still-accepted APIs so expensive to audit, as with Kyverno's ClusterPolicy removal leaving podSecurity without a CEL equivalent.
What APPLY_METHOD says, and what its three values mean
helm get metadata prints APPLY_METHOD: through formatApplyMethod in pkg/cmd/get_metadata.go, which maps three stored values onto three strings:
| Stored value | Printed as | What it means | --force-replace |
|---|---|---|---|
ssa | server-side apply | Installed by Helm 4 with defaults | Rejected before any object is touched |
csa | client-side apply | Someone passed --server-side=false | Works |
| empty | client-side apply (defaulted) | Release predates the field, so Helm 3 installed it | Works, until someone passes --server-side=true |
The release struct carries it as ApplyMethod string \json:"apply_method,omitempty"\` with the comment "Unset (empty string) should be treated as the default of client-side apply" (pkg/release/v1/release.go), and the constants are ApplyMethodClientSideApply = "csa" and ApplyMethodServerSideApply = "ssa"`. Reading the stored record instead of inferring from the binary on the PATH is the same discipline that pays off when a state file turns out to be NUL-padded rather than corrupt.
The resolution happens in pkg/action/upgrade.go, called as getUpgradeServerSideValue(u.ServerSideApply, lastRelease.ApplyMethod), and the auto branch is one comparison:
case "auto":
return releaseApplyMethod == "ssa", nil
Pick the fix from what you wanted --force to do
# You needed the object recreated (immutable field): keep replace, drop SSA for this run
helm upgrade csa-demo ./demo --force-replace --server-side=false
# You needed to win a field-ownership fight: that is force-conflicts, not replace
helm upgrade ssa-demo ./demo --force-conflicts
# --force was muscle memory: delete it
helm upgrade ssa-demo ./demo
The first one has a side effect no changelog states. prepareUpgrade writes ApplyMethod: string(determineReleaseSSApplyMethod(serverSideApply)) into the new release, so a one-off --server-side=false records csa and every subsequent auto run keeps that release client-side. The job goes green and the release quietly changes category, which is the same class of silent-success problem as Terraform 1.17's -minimal-refresh exiting 0 with drift still present. If you use that escape hatch in CI, set --server-side=true back explicitly on the next deploy.
Moving a Helm 3 release onto server-side apply
helm upgrade legacy-demo ./demo --server-side=true
When the previous release is csa or empty and the new value is true, Helm enables a third option:
upgradeClientSideFieldManager := isReleaseApplyMethodClientSideApply(originalRelease.ApplyMethod) && serverSideApply
ClientUpdateOptionUpgradeClientSideFieldManager's doc comment states the stakes: it is "required when upgrading a chart from client-side to server-side apply, otherwise the client-side field management remains. Conflicting with server-side applied updates." It calls csaupgrade.UpgradeManagedFieldsPatch(info.Object, sets.New(fieldManagerName), fieldManagerName) and sends the result as a JSON patch, so the old Update entry on the object is rewritten rather than left to fight the new applier.
Check both layers afterwards
helm get metadata legacy-demo | grep APPLY_METHOD
kubectl get deploy/legacy-demo-demo -o json --show-managed-fields \
| jq -r '.metadata.managedFields[] | "\(.manager)\t\(.operation)"'
Helm should print APPLY_METHOD: server-side apply, and the object's own managedFields should show the Helm entry with operation: Apply rather than the Update entry a client-side patch leaves behind. The second command is the queryable ground truth, because it names who owns which fields, and it is what a conflict message quotes back at you.
One detail to keep in mind while reading that output: Helm's field manager name is not a constant. getManagedFieldsManager() returns the package variable ManagedFieldsManager if an SDK consumer set it, otherwise filepath.Base(os.Args[0]), so the manager string is whatever your binary happens to be called.
That leaves one row I have not verified end to end. Since upgradeClientSideFieldManager passes the same name as both the old manager set and the new owner, a release originally installed by a wrapper or a renamed binary (helm3, /opt/bin/helm-4.3.2) should keep its stale Update entry through the migration, because the patch looks for a manager name that does not match. Settle it by installing with a renamed copy of the binary, upgrading with the real one, and reading the managedFields output above.
Three failures wearing the force costume
- Replace plus conflicts fails earlier, at parse.
pkg/cmd/upgrade.godeclaresMarkFlagsMutuallyExclusive("force-replace", "force-conflicts")and the same pairing for the deprecatedforce. Cobra rejects it before the cluster is contacted, so that error is a different layer from the one in the title. Which layer refused you is the fastest discriminator. --force-conflictswith server-side apply off returnsforceConflicts enabled when serverSideApply disabled, a third distinct string.- Retrying the job will not clear a field conflict.
isServerSideRetryableonly retries conflicts matchingOperation cannot be fulfilled on resourcequotasorthe object has been modified(viaisResourceQuotaConflict). Ownership conflicts are terminal, so a retry loop burns minutes for nothing. - A typo in the value blames the wrong thing.
--server-side=yesgets youinvalid/unknown release server-side apply method: yes, which says release even though the bad value came from your flag. --atomicto--rollback-on-failureis not a pure rename. Its help text says--wait"will be defaulted to 'watcher'" when it is set, so wait behaviour changes along with the name.- Rollback inherits the flags.
failReleasepassesForceReplace,ForceConflictsandServerSideApplyinto the rollback path, so a--rollback-on-failurerun can meet the same validation on the way back. Confirm that with a deliberately failing upgrade before you rely on it.
A field note from a recent patch day, because the instinct transfers: rather than trusting node -v on a box, I fed a behavioural probe from Node's own test suite to the decoder and read the returned error code, which said unpatched on an end-of-life Node 20 host that the version table had already cleared. APPLY_METHOD is that move for Helm. Ask the release what it is instead of inferring it from the binary on the PATH.
Run the grep across the fleet before CI does
This is not an optional migration. Helm 3 is in its security-fix-only window per Helm's own Helm 3 end-of-life post, and the error is already landing in real projects: k0s found charts it installs failing on every upgrade with this exact string (k0sproject/k0s#8718, backported in #8721), and the Terraform Helm provider hit it while moving to the v4 SDK (hashicorp/terraform-provider-helm#1873). So list the releases that are still client-side apply (defaulted), because those are the ones that break the day someone sets --server-side=true:
helm list -A -o json | jq -r '.[] | "\(.namespace) \(.name)"' \
| while read -r ns rel; do
printf '%s/%s\t%s\n' "$ns" "$rel" \
"$(helm get metadata "$rel" -n "$ns" | awk -F': ' '/^APPLY_METHOD/{print $2}')"
done
**Word count:** ~1,520 words of substance.
A few editorial decisions worth naming:
- **Dates dropped.** The draft asked me to verify the 10 February 2027 Helm 3 EOL date and the 4.3.2/4.3.3 release dates. helm.sh was unreachable from this session, so rather than assert them I cite the end-of-life post for the security-fix-only window without a date. `4.3.2` stays only as the binary version the walkthrough was written against.
- **No fabricated terminal output.** The draft asked for pasted output from both runs. I quoted the error string verbatim from `pkg/kube/client.go` (which the reader can grep) and described the `Error: UPGRADE FAILED:` wrapper rather than inventing a full transcript.
- **Internal links swapped.** Three of the draft's four suggested slugs (`kubernetes-1-37-drops-18-kubelet-flags…`, `cosign-v3…`, and the k0s-adjacent one) are not in the supplied catalog, so I used four that are: containerd/kubelet, Kyverno ClusterPolicy, state-file NUL padding, and Terraform `-minimal-refresh`. Two land in the first third.
- **Closer is a command,** not a verdict: a fleet-wide `APPLY_METHOD` sweep built from `helm list -A -o json`.
Comments
Be the first to comment.