{"record":{"id":"c8ce0bceceec38c4","repo":"GoogleContainerTools/skaffold","slug":"skaffold-apply-called-with-conflicting-namespaces","errorCode":null,"errorMessage":"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","messagePattern":"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","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/skaffold/runner/deployer.go","lineNumber":126,"sourceCode":"\n\t\t\tif d.LegacyHelmDeploy != nil {\n\t\t\t\tfor _, release := range d.LegacyHelmDeploy.Releases {\n\t\t\t\t\tif release.Namespace != \"\" {\n\t\t\t\t\t\thelmNamespaces[release.Namespace] = true\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif cloudRunDeployFound {\n\t\t\tif nonHelmDeployFound || len(helmNamespaces) > 0 {\n\t\t\t\t// Cloud Run doesn't support multiple deployers in the config.\n\t\t\t\treturn nil, errors.New(\"skaffold apply called with both Cloud Run and Kubernetes deployers. Mixing deployment targets is not allowed\" +\n\t\t\t\t\t\" when using the Cloud Run deployer\")\n\t\t\t}\n\t\t\treturn getCloudRunDeployer(runCtx, labeller, pipelines.Deployers(), \"\")\n\t\t}\n\t\tif len(helmNamespaces) > 1 || (nonHelmDeployFound && len(helmNamespaces) == 1) {\n\t\t\treturn 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\")\n\t\t}\n\n\t\tif len(helmNamespaces) == 1 && !nonHelmDeployFound {\n\t\t\tif runCtx.Opts.Namespace == \"\" {\n\t\t\t\t// if skaffold --namespace flag not set, use the helm namespace value\n\t\t\t\tfor k := range helmNamespaces {\n\t\t\t\t\t// map only has 1 (k,v) from length check in if condition\n\t\t\t\t\trunCtx.Opts.Namespace = k\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn getDefaultDeployer(runCtx, labeller, gks)\n\t}\n\n\tvar deployers []deploy.Deployer\n\tlocalDeploy := false\n\tremoteDeploy := false","sourceCodeStart":108,"sourceCodeEnd":144,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/pkg/skaffold/runner/deployer.go#L108-L144","documentation":"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.","triggerScenarios":"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`.","commonSituations":"Configs migrated from `skaffold run` (where helm namespace works) to `skaffold apply`; multiple releases intentionally deployed to different namespaces; mixed kubectl+helm pipelines.","solutions":["Remove the `deploy.helm.releases.*.namespace` fields from skaffold.yaml and re-run `skaffold apply`","Set the target namespace globally with the `--namespace` flag instead of per-release namespace fields","Split releases targeting different namespaces into separate skaffold projects/invocations"],"exampleFix":"// before\nreleases:\n  - name: a\n    chartPath: chart-a\n    namespace: ns-a\n  - name: b\n    chartPath: chart-b\n    namespace: ns-b\n// after\nreleases:\n  - name: a\n    chartPath: chart-a\n  - name: b\n    chartPath: chart-b\n# then: skaffold apply --namespace ns-a","handlingStrategy":"validation","validationCode":"namespaces := map[string]bool{}\nfor _, r := range cfg.Deploy.Helm.Releases { if r.Namespace != \"\" { namespaces[r.Namespace] = true } }\nif len(namespaces) > 1 { return errors.New(\"apply does not support multiple helm release namespaces; use --namespace and remove release namespaces\") }","typeGuard":"func helmReleasesHaveNamespace(cfg *latest.SkaffoldConfig) bool {\n  for _, r := range cfg.Deploy.Helm.Releases { if r.Namespace != \"\" { return true } }\n  return false\n}","tryCatchPattern":"deployer, err := runner.GetDeployer(ctx, runCtx, labeller, cfg)\nif err != nil && strings.Contains(err.Error(), \"deploy.helm.releases.*.namespace\") {\n  return fmt.Errorf(\"strip per-release namespaces for apply: %w\", err)\n}","preventionTips":["Avoid deploy.helm.releases.*.namespace when using `skaffold apply`; use --namespace flag instead","Deploy releases to different namespaces via separate invocations","Diff configs after migrating between skaffold run and apply"],"tags":["skaffold","helm","namespace-conflict"],"backgroundTag":"conflicting-helm-namespaces","analyzedSha":"a1189de023efc32d4b8e11f395acc678aa555011","analyzedAt":"2026-09-05T12:09:27.064Z","contentChangedAt":"2026-09-05T12:09:27.064Z","schemaVersion":2},"datasetVersion":"2026-09-12T17:17:11.597Z"}