GoogleContainerTools/skaffold · error
found multiple namespaces in skaffold.yaml (not supported…
Error message
found multiple namespaces in skaffold.yaml (not supported in `skaffold apply`): %s, %s
What it means
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.
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
Example fix
// config-a (before)
deploy:
kubectl:
defaultNamespace: frontend
// config-b (before)
deploy:
kubectl:
defaultNamespace: backend
// after
# remove both; run: skaffold apply --namespace frontend Defensive patterns
Strategy: validation
Validate before calling
const ns = [...new Set(configs.map(c => c.deploy?.kubectl?.defaultNamespace).filter(Boolean))]
if (ns.length > 1) {
throw new Error('conflicting defaultNamespace values: ' + ns.join(', '))
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- creating deployer
- found multiple log prefixes in skaffold.yaml (not supported…
- found multiple status check timeouts in skaffold.yaml (not…
- cannot parse the release namespace template
- cannot resolve active Kubernetes context - multiple…
AI-assisted analysis of GoogleContainerTools/skaffold@a1189de023 (2026-09-05).
Data as JSON: /api/errors/df041b984eaae9f7.
Report an issue: GitHub.
Appendix: source
Thrown at pkg/skaffold/runner/deployer.go:282
return nil, fmt.Errorf("found multiple log prefixes in skaffold.yaml (not supported in `skaffold apply`): %s, %s", logPrefix, d.Logs.Prefix)
}
logPrefix = d.Logs.Prefix
}
var currentDefaultNamespace *string
var currentKubectlFlags latest.KubectlFlags
if d.KubectlDeploy != nil {
currentDefaultNamespace = d.KubectlDeploy.DefaultNamespace
currentKubectlFlags = d.KubectlDeploy.Flags
}
if kFlags == nil {
kFlags = ¤tKubectlFlags
}
if err := validateKubectlFlags(kFlags, currentKubectlFlags); err != nil {
return nil, err
}
if currentDefaultNamespace != nil {
if defaultNamespace != nil && *defaultNamespace != *currentDefaultNamespace {
return nil, fmt.Errorf("found multiple namespaces in skaffold.yaml (not supported in `skaffold apply`): %s, %s", *defaultNamespace, *currentDefaultNamespace)
}
defaultNamespace = currentDefaultNamespace
}
}
if kFlags == nil {
kFlags = &latest.KubectlFlags{}
}
k := &latest.KubectlDeploy{
Flags: *kFlags,
DefaultNamespace: defaultNamespace,
}
dCtx := &deployerCtx{runCtx, latest.DeployConfig{StatusCheck: statusCheck, KubeContext: kubeContext, DeployType: latest.DeployType{KubectlDeploy: k}}}
defaultDeployer, err := kubectl.NewDeployer(dCtx, labeller, k, runCtx.Artifacts(), "", selectors)
if err != nil {
return nil, fmt.Errorf("instantiating default kubectl deployer: %w", err)
}
return defaultDeployer, nil
}View on GitHub (pinned to a1189de023)