GoogleContainerTools/skaffold · error

skaffold apply called with conflicting namespaces set via…

Error message

skaffold apply called with conflicting namespaces set via skaffold.yaml. This is likely due to the use of the 'deploy.helm.releases.*.namespace' field which is not supported in apply.  Remove the 'deploy.helm.releases.*.namespace' field(s) and run skaffold apply again

What it means

GetDeployer validates helm release namespaces for `skaffold apply`, which does not support the deploy.helm.releases.*.namespace field. If more than one helm namespace is set, or a non-helm deployer is combined with exactly one helm namespace, the resulting conflicting/unsupported namespace configuration aborts with this error.

Solutions

  1. Remove the `deploy.helm.releases.*.namespace` fields from skaffold.yaml and re-run `skaffold apply`
  2. Set the target namespace globally with the `--namespace` flag instead of per-release namespace fields
  3. Split releases targeting different namespaces into separate skaffold projects/invocations

Example fix

// before
releases:
  - name: a
    chartPath: chart-a
    namespace: ns-a
  - name: b
    chartPath: chart-b
    namespace: ns-b
// after
releases:
  - name: a
    chartPath: chart-a
  - name: b
    chartPath: chart-b
# then: skaffold apply --namespace ns-a
Defensive patterns

Strategy: validation

Validate before calling

namespaces := map[string]bool{}
for _, r := range cfg.Deploy.Helm.Releases { if r.Namespace != "" { namespaces[r.Namespace] = true } }
if len(namespaces) > 1 { return errors.New("apply does not support multiple helm release namespaces; use --namespace and remove release namespaces") }

Type guard

func helmReleasesHaveNamespace(cfg *latest.SkaffoldConfig) bool {
  for _, r := range cfg.Deploy.Helm.Releases { if r.Namespace != "" { return true } }
  return false
}

Try / catch

deployer, err := runner.GetDeployer(ctx, runCtx, labeller, cfg)
if err != nil && strings.Contains(err.Error(), "deploy.helm.releases.*.namespace") {
  return fmt.Errorf("strip per-release namespaces for apply: %w", err)
}

Prevention

When it happens

Trigger: skaffold.yaml has helm releases with two different `namespace` values, or a kubectl/kustomize deployer plus one helm release that sets `namespace`, followed by `skaffold apply`.

Common situations: Configs migrated from `skaffold run` (where helm namespace works) to `skaffold apply`; multiple releases intentionally deployed to different namespaces; mixed kubectl+helm pipelines.

Related errors


AI-assisted analysis of GoogleContainerTools/skaffold@a1189de023 (2026-09-05). Data as JSON: /api/errors/c8ce0bceceec38c4. Report an issue: GitHub.

Appendix: source

Thrown at pkg/skaffold/runner/deployer.go:126

			if d.LegacyHelmDeploy != nil {
				for _, release := range d.LegacyHelmDeploy.Releases {
					if release.Namespace != "" {
						helmNamespaces[release.Namespace] = true
					}
				}
			}
		}
		if cloudRunDeployFound {
			if nonHelmDeployFound || len(helmNamespaces) > 0 {
				// Cloud Run doesn't support multiple deployers in the config.
				return nil, errors.New("skaffold apply called with both Cloud Run and Kubernetes deployers. Mixing deployment targets is not allowed" +
					" when using the Cloud Run deployer")
			}
			return getCloudRunDeployer(runCtx, labeller, pipelines.Deployers(), "")
		}
		if len(helmNamespaces) > 1 || (nonHelmDeployFound && len(helmNamespaces) == 1) {
			return nil, errors.New("skaffold apply called with conflicting namespaces set via skaffold.yaml. This is likely due to the use of the 'deploy.helm.releases.*.namespace' field which is not supported in apply.  Remove the 'deploy.helm.releases.*.namespace' field(s) and run skaffold apply again")
		}

		if len(helmNamespaces) == 1 && !nonHelmDeployFound {
			if runCtx.Opts.Namespace == "" {
				// if skaffold --namespace flag not set, use the helm namespace value
				for k := range helmNamespaces {
					// map only has 1 (k,v) from length check in if condition
					runCtx.Opts.Namespace = k
				}
			}
		}

		return getDefaultDeployer(runCtx, labeller, gks)
	}

	var deployers []deploy.Deployer
	localDeploy := false
	remoteDeploy := false

View on GitHub (pinned to a1189de023)