{"record":{"id":"df041b984eaae9f7","repo":"GoogleContainerTools/skaffold","slug":"found-multiple-namespaces-in-skaffold-yaml-not-su","errorCode":null,"errorMessage":"found multiple namespaces in skaffold.yaml (not supported in `skaffold apply`): %s, %s","messagePattern":"found multiple namespaces in skaffold\\.yaml \\(not supported in `skaffold apply`\\): (.+?), (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/skaffold/runner/deployer.go","lineNumber":282,"sourceCode":"\t\t\t\treturn nil, fmt.Errorf(\"found multiple log prefixes in skaffold.yaml (not supported in `skaffold apply`): %s, %s\", logPrefix, d.Logs.Prefix)\n\t\t\t}\n\t\t\tlogPrefix = d.Logs.Prefix\n\t\t}\n\t\tvar currentDefaultNamespace *string\n\t\tvar currentKubectlFlags latest.KubectlFlags\n\t\tif d.KubectlDeploy != nil {\n\t\t\tcurrentDefaultNamespace = d.KubectlDeploy.DefaultNamespace\n\t\t\tcurrentKubectlFlags = d.KubectlDeploy.Flags\n\t\t}\n\t\tif kFlags == nil {\n\t\t\tkFlags = &currentKubectlFlags\n\t\t}\n\t\tif err := validateKubectlFlags(kFlags, currentKubectlFlags); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif currentDefaultNamespace != nil {\n\t\t\tif defaultNamespace != nil && *defaultNamespace != *currentDefaultNamespace {\n\t\t\t\treturn nil, fmt.Errorf(\"found multiple namespaces in skaffold.yaml (not supported in `skaffold apply`): %s, %s\", *defaultNamespace, *currentDefaultNamespace)\n\t\t\t}\n\t\t\tdefaultNamespace = currentDefaultNamespace\n\t\t}\n\t}\n\tif kFlags == nil {\n\t\tkFlags = &latest.KubectlFlags{}\n\t}\n\tk := &latest.KubectlDeploy{\n\t\tFlags:            *kFlags,\n\t\tDefaultNamespace: defaultNamespace,\n\t}\n\tdCtx := &deployerCtx{runCtx, latest.DeployConfig{StatusCheck: statusCheck, KubeContext: kubeContext, DeployType: latest.DeployType{KubectlDeploy: k}}}\n\tdefaultDeployer, err := kubectl.NewDeployer(dCtx, labeller, k, runCtx.Artifacts(), \"\", selectors)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"instantiating default kubectl deployer: %w\", err)\n\t}\n\treturn defaultDeployer, nil\n}","sourceCodeStart":264,"sourceCodeEnd":300,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/pkg/skaffold/runner/deployer.go#L264-L300","documentation":"getDefaultDeployer merges default namespaces across multiple skaffold configs for `skaffold apply`. When two configs resolve to different default namespaces (explicitly set or derived from their deployer configs), the merge is ambiguous and this error is returned with both namespace names.","triggerScenarios":"Running `skaffold apply` with multiple skaffold configs whose resolved default namespaces differ — either explicit `deploy.kubectl.defaultNamespace` values or namespaces inferred from different kube contexts/kubectl flags per config.","commonSituations":"Multi-config apply where each service config targets a different namespace (e.g. dev vs prod); configs written for separate clusters with distinct implicit namespaces.","solutions":["Set the same `defaultNamespace` in every composed skaffold config","Remove `defaultNamespace` from the configs and pass a single namespace via `--namespace` or `kubectl --context`","Ensure all configs resolve against the same kube context so implicit namespaces match"],"exampleFix":"// config-a (before)\ndeploy:\n  kubectl:\n    defaultNamespace: frontend\n// config-b (before)\ndeploy:\n  kubectl:\n    defaultNamespace: backend\n// after\n# remove both; run: skaffold apply --namespace frontend","handlingStrategy":"validation","validationCode":"const ns = [...new Set(configs.map(c => c.deploy?.kubectl?.defaultNamespace).filter(Boolean))]\nif (ns.length > 1) {\n  throw new Error('conflicting defaultNamespace values: ' + ns.join(', '))\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Omit defaultNamespace in composed configs and pass one namespace via --namespace","Ensure all configs target the same kube context so implicit namespaces match","Document a single namespace convention per environment"],"tags":["deploy","config","apply","namespace","kubernetes"],"backgroundTag":"conflicting-skaffold-configs","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"}