{"record":{"id":"4449f57743a6bd02","repo":"GoogleContainerTools/skaffold","slug":"skaffold-apply-called-with-both-cloud-run-and-kube","errorCode":null,"errorMessage":"skaffold apply called with both Cloud Run and Kubernetes deployers. Mixing deployment targets is not allowed when using the Cloud Run deployer","messagePattern":"skaffold apply called with both Cloud Run and Kubernetes deployers\\. Mixing deployment targets is not allowed when using the Cloud Run deployer","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/skaffold/runner/deployer.go","lineNumber":120,"sourceCode":"\t\t\t\tnonHelmDeployFound = true\n\t\t\t}\n\n\t\t\tif d.CloudRunDeploy != nil {\n\t\t\t\tcloudRunDeployFound = true\n\t\t\t}\n\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","sourceCodeStart":102,"sourceCodeEnd":138,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/pkg/skaffold/runner/deployer.go#L102-L138","documentation":"When constructing the deployer for `skaffold apply`, GetDeployer rejects configs that mix the Cloud Run deployer with Kubernetes deployers (any non-helm deployer or helm releases with namespaces), because Cloud Run deploys cannot be combined with other deployment targets. The error is returned before any deployment starts.","triggerScenarios":"skaffold.yaml (possibly merged across profiles/required configs) contains both a `cloudrun` deploy entry and a k8s/helm deploy entry, and `skaffold apply` is run.","commonSituations":"Teams adding Cloud Run to an existing k8s skaffold.yaml; profile merging pulling in a cloudrun deployer alongside kubectl/helm deployers; copy-pasted deploy sections.","solutions":["Split the config so Cloud Run and Kubernetes deployers live in separate skaffold projects and run `skaffold apply` for each separately","Use profiles to select exactly one deployer per apply invocation and pass the intended -p flag","Remove the unwanted deployer section (cloudrun or k8s/helm) from skaffold.yaml"],"exampleFix":"// before\ndeploy:\n  cloudrun: {projectid: my-proj}\n  kubectl: {manifests: [k8s/*.yaml]}\n// after\ndeploy:\n  kubectl: {manifests: [k8s/*.yaml]}  # keep only one deployer target per apply\n","handlingStrategy":"validation","validationCode":"hasCloudRun, hasK8s := false, false\nfor _, d := range cfg.Deploy { /* classify cloudrun vs kubectl/helm/kustomize */ }\nif hasCloudRun && hasK8s { return errors.New(\"skaffold.yaml mixes Cloud Run and Kubernetes deployers; keep one target per project\") }","typeGuard":"func isCloudRunOnly(d latest.DeployConfig) bool { return d.CloudRunDeploy != nil && d.KubectlDeploy == nil && d.HelmDeploy == nil && d.KustomizeDeploy == nil }","tryCatchPattern":"deployer, err := runner.GetDeployer(ctx, runCtx, labeller, cfg)\nif err != nil && strings.Contains(err.Error(), \"Mixing deployment targets\") {\n  return fmt.Errorf(\"split cloudrun and k8s configs into separate projects: %w\", err)\n}","preventionTips":["Keep Cloud Run and Kubernetes deployments in separate skaffold projects","Review profile merges for accidental deployer sections","Audit skaffold.yaml deploy sections after migrations"],"tags":["skaffold","cloud-run","deployer-config"],"backgroundTag":"mixed-deployers-not-allowed","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"}