GoogleContainerTools/skaffold · error

upgrading main pipeline: %w

Error message

upgrading main pipeline: %w

What it means

pipelineUpgrader.mainPipeline upgrades the top-level 'pipeline' section of a skaffold config via reflection (FieldByName) and invokes the versioned upgrade function. If that upgrade call returns an error, it is wrapped with this prefix so the caller knows the failure was in the main pipeline, not in a profile. The wrapped cause (e.g. an unsupported-field error from the versioned Upgrade) is preserved with %w.

Source

Thrown at pkg/skaffold/schema/util/upgrade_pipelines.go:66

		upgrade:   upgrade,
	}

	if err := upgrader.mainPipeline(); err != nil {
		return err
	}

	return upgrader.profiles()
}

func (u *pipelineUpgrader) mainPipeline() error {
	const fieldMainPipeline = "Pipeline"

	oldPipeline := u.oldConfig.FieldByName(fieldMainPipeline).Addr().Interface()
	newPipeline := u.newConfig.FieldByName(fieldMainPipeline).Addr().Interface()

	err := u.upgrade(oldPipeline, newPipeline)
	if err != nil {
		return fmt.Errorf("upgrading main pipeline: %w", err)
	}

	return nil
}

func (u *pipelineUpgrader) profiles() error {
	const (
		fieldProfilePipeline = "Pipeline"
		fieldProfiles        = "Profiles"
	)

	profilesOld := u.oldConfig.FieldByName(fieldProfiles)
	profilesNew := u.newConfig.FieldByName(fieldProfiles)

	if profilesOld.Len() != profilesNew.Len() {
		return fmt.Errorf("lengths of old and new profiles differ")
	}

View on GitHub (pinned to a1189de023)

Solutions

  1. Inspect the wrapped cause (%w chain) to see which main-pipeline field the upgrade rejected
  2. Edit skaffold.yaml to remove or migrate the unsupported main-pipeline field, then retry the upgrade
  3. Use `skaffold fix` to regenerate the config at the target version

Example fix

// before (skaffold.yaml)
build:
  acr: {...}
// after
build:
  artifacts: [...]
Defensive patterns

Strategy: validation

Validate before calling

if cfg.Build == nil || cfg.Deploy == nil { return errors.New("config missing required sections") }

Try / catch

err := util.UpgradePipelines(old, new, u.upgrade)
if err != nil {
	var inner error
	if errors.As(err, &inner) && strings.Contains(err.Error(), "upgrading main pipeline") {
		// inspect inner cause
	}
}

Prevention

When it happens

Trigger: Calling UpgradePipelines on a config whose main pipeline section fails the versioned Upgrade() — e.g. it contains fields removed in the target version (like build.acr) or an incompatible structure the upgrade function rejects.

Common situations: Running skaffold on an older skaffold.yaml targeting a newer schema where a top-level deploy/build feature was dropped; configs with both legacy and new deploy blocks that the upgrade logic cannot reconcile.

Related errors


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