GoogleContainerTools/skaffold · error

expected all Cloud Run deploys to use the same project, foun

Error message

expected all Cloud Run deploys to use the same project, found deploys to projects %s and %s

What it means

The Cloud Run deployer requires all Cloud Run deploy stanzas to target the same Google Cloud project. When no --project flag is supplied and configs disagree on ProjectID, this error aborts deployer construction.

Source

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

		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)
				}
			}
		}
	}
	statusCheckDeadline := maxStatusCheckDeadline(deployers)
	tolerateFailures := runCtx.StatusCheckTolerateFailures()
	// The runctx.StatusCheck() method returns the value set by the cli flag `--status-check`,
	// which overrides the value set in the individual configs.
	if cliStatusCheck := runCtx.StatusCheck(); cliStatusCheck != nil {

View on GitHub (pinned to a1189de023)

Solutions

  1. Pass --project to pin a single target project
  2. Set the same ProjectID in every CloudRunDeploy stanza
  3. Split deploys per project into separate skaffold runs

Example fix

// before
projects: proj-a / proj-b
// after
skaffold apply --project proj-a
Defensive patterns

Strategy: validation

Validate before calling

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

Type guard

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

Try / catch

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

Prevention

When it happens

Trigger: getCloudRunDeployer iterating configs: projectFlag not set, defaultProject already set from a prior stanza, and current crDeploy.ProjectID differs from it.

Common situations: Composing multiple skaffold configs that deploy Cloud Run services into different GCP projects; running `skaffold apply` without --project in a multi-project setup.

Related errors


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