GoogleContainerTools/skaffold · error

expected all Cloud Run deploys to be in the same region, fou

Error message

expected all Cloud Run deploys to be in the same region, found deploys to %s and %s

What it means

The Cloud Run deployer for `skaffold apply` requires every Cloud Run deploy stanza to target one region. When no --region flag is supplied and configs disagree (first non-empty region vs a subsequent different region), this error aborts deployer construction.

Source

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

	regionFlag := false
	var defaultProject string
	projectFlag := false
	if runCtx.Opts.CloudRunLocation != "" {
		region = runCtx.Opts.CloudRunLocation
		regionFlag = true
	}
	if runCtx.Opts.CloudRunProject != "" {
		defaultProject = runCtx.Opts.CloudRunProject
		projectFlag = true
	}
	var enableStatusCheck *bool
	for _, d := range deployers {
		if d.CloudRunDeploy != nil {
			crDeploy := d.CloudRunDeploy
			if !regionFlag {
				// No region flag was provided, so take it from the config.
				if region != "" && region != crDeploy.Region {
					return nil, fmt.Errorf("expected all Cloud Run deploys to be in the same region, found deploys to %s and %s", region, crDeploy.Region)
				}

				region = crDeploy.Region
			}
			if !projectFlag {
				// No project flag was specified so take it from the config.
				if defaultProject != "" && defaultProject != crDeploy.ProjectID {
					return nil, fmt.Errorf("expected all Cloud Run deploys to use the same project, found deploys to projects %s and %s", defaultProject, crDeploy.ProjectID)
				}
				defaultProject = crDeploy.ProjectID
			}
			if d.StatusCheck != nil {
				if enableStatusCheck == nil {
					enableStatusCheck = d.StatusCheck
				} else if enableStatusCheck != d.StatusCheck {
					// if we get conflicting values for status check from different skaffold configs, we turn status check off
					enableStatusCheck = util.Ptr(false)
				}

View on GitHub (pinned to a1189de023)

Solutions

  1. Pass an explicit --region flag so config regions are ignored
  2. Make all CloudRunDeploy.Region values identical across configs
  3. Split the deployment into separate skaffold invocations per region

Example fix

// before (configs disagree, no flag)
regions: us-central1 / europe-west1
// after
skaffold apply --region us-central1
Defensive patterns

Strategy: validation

Validate before calling

const regions = [...new Set(configs.map(c => c.deploy?.cloudrun?.region).filter(Boolean))]
if (regions.length > 1 && !cliRegion) throw new Error(`multiple regions in configs: ${regions}; pass --region`)

Type guard

function singleRegion(configs, cliRegion) {
  const set = new Set(configs.map(c => c.deploy?.cloudrun?.region).filter(Boolean))
  return cliRegion != null || set.size <= 1
}

Try / catch

if err := getCloudRunDeployer(...); err != nil {
    if strings.Contains(err.Error(), "same region") {
        return retryWithFlag("--region", firstRegion)
    }
    return err
}

Prevention

When it happens

Trigger: getCloudRunDeployer iterating multiple configs: regionFlag not set, region already taken from a previous stanza, and current crDeploy.Region differs from it.

Common situations: Multi-config skaffold project (skaffold.yaml with multiple -f configs) where one config deploys to us-central1 and another to europe-west1; forgotten --region flag.

Related errors


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