GoogleContainerTools/skaffold · error

getting target platforms: %w

Error message

getting target platforms: %w

What it means

When multi-platform builds are configured, `platform.NewResolver` computes the target platforms for all pipelines from the `platforms:` fields in skaffold.yaml and CLI `--platforms`. This wraps failures to resolve those platform strings into valid GOOS/GOARCH targets.

Source

Thrown at pkg/skaffold/runner/new.go:103

		return nil, fmt.Errorf("creating renderer: %w", err)
	}

	deployer, err = GetDeployer(ctx, runCtx, labeller, hydrationDir, runCtx.UsingLegacyHelmDeploy())
	if err != nil {
		endTrace(instrumentation.TraceEndError(err))
		return nil, fmt.Errorf("creating deployer: %w", err)
	}
	rOpts := platform.ResolverOpts{
		KubeContext:               runCtx.KubeContext,
		CliPlatformsSelection:     runCtx.Opts.Platforms,
		CheckClusterNodePlatforms: runCtx.CheckClusterNodePlatforms(),
		DisableMultiPlatformBuild: runCtx.DisableMultiPlatformBuild(),
	}

	platforms, err := platform.NewResolver(ctx, runCtx.Pipelines.All(), rOpts)
	if err != nil {
		endTrace(instrumentation.TraceEndError(err))
		return nil, fmt.Errorf("getting target platforms: %w", err)
	}

	var verifier verify.Verifier
	verifier, err = GetVerifier(ctx, runCtx, labeller)
	if err != nil {
		endTrace(instrumentation.TraceEndError(err))
		return nil, fmt.Errorf("creating verifier: %w", err)
	}

	var acsRunner ActionsRunner
	acsRunner, err = GetActionsRunner(ctx, runCtx, labeller, runCtx.VerifyDockerNetwork(), runCtx.Opts.VerifyEnvFile)
	if err != nil {
		endTrace(instrumentation.TraceEndError(err))
		return nil, fmt.Errorf("creating actiosn runner: %w", err)
	}

	depLister := func(ctx context.Context, artifact *latest.Artifact, tag string) ([]string, error) {
		ctx, endTrace := instrumentation.StartTrace(ctx, "NewForConfig_depLister")

View on GitHub (pinned to a1189de023)

Solutions

  1. Fix platform strings to valid `os/arch[/variant]` triples (e.g. `linux/amd64`, `linux/arm64`, `linux/arm/v7`).
  2. Remove conflicting platform selections so pipelines and `--platforms` agree.
  3. Verify your builder supports the requested platforms (Docker buildx/Daemon multi-platform must be enabled).
  4. Omit `platforms:` entirely if you only need the default host platform.

Example fix

// skaffold.yaml before
build:
  platforms: ["linux/armv99"]
// after
build:
  platforms: ["linux/arm64"]
Defensive patterns

Strategy: validation

Validate before calling

var validPlatform = regexp.MustCompile(`^(linux|darwin|windows)/((amd64|arm64|arm|386)(/(v[5-8]))?)$`)
func checkPlatforms(ps []string) error {
  for _, p := range ps {
    if !validPlatform.MatchString(p) {
      return fmt.Errorf("invalid platform %q (want os/arch[/variant])", p)
    }
  }
  return nil
}

Try / catch

runner, err := runner.NewForConfig(runCtx)
if err != nil {
  if strings.Contains(err.Error(), "getting target platforms") {
    return fmt.Errorf("platform config invalid: %w", err)
  }
  return err
}

Prevention

When it happens

Trigger: Invalid or unknown platform strings in skaffold.yaml `platforms:` or `--platforms` flag (e.g. `linux/armv7` unsupported by the builder), conflicting platform selections across pipelines, or a platform specifier that fails to parse.

Common situations: Typo'd platform like `linux/amd64/x` after a config edit; requesting platforms the cluster/build backend can't support; mixing `--platforms` CLI with per-artifact platforms inconsistently.

Related errors


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