GoogleContainerTools/skaffold · error

found a '%s' artifact, which is incompatible with the 'local

Error message

found a '%s' artifact, which is incompatible with the 'local' builder:

%s

To use the '%s' builder, add the 'cluster' stanza to the 'build' section of your configuration. For information, see https://skaffold.dev/docs/pipeline-stages/builders/

What it means

The 'local' builder (build.local) can only build docker, jib, buildpack, and ko-style artifacts. If any artifact is a kaniko (cluster) artifact, Skaffold fails validation because the local Docker daemon cannot perform a kaniko build, and it suggests switching the build stanza.

Source

Thrown at pkg/skaffold/schema/validation/validation.go:650

				cfgErrs = append(cfgErrs, ErrorWithLocation{
					Error:    fmt.Errorf("artifact %s has an invalid pattern %s for inferred file sync with the ko builder. The pattern must specify the 'kodata' directory. For instance, if you want to sync all static content, and your main package is in the workspace directory, you can use the pattern 'kodata/**/*'", a.ImageName, pattern),
					Location: cfg.YAMLInfos.LocateField(cfg.Build.Artifacts[i].Sync, "Infer"),
				})
			}
		}
	}
	return cfgErrs
}

// validateArtifactTypes checks that the artifact types are compatible with the specified builder.
func validateArtifactTypes(cfg *parser.SkaffoldConfigEntry, bc latest.BuildConfig) []ErrorWithLocation {
	cfgErrs := []ErrorWithLocation{}
	switch {
	case bc.LocalBuild != nil:
		for i, a := range bc.Artifacts {
			if misc.ArtifactType(a) == misc.Kaniko {
				cfgErrs = append(cfgErrs, ErrorWithLocation{
					Error:    fmt.Errorf("found a '%s' artifact, which is incompatible with the 'local' builder:\n\n%s\n\nTo use the '%s' builder, add the 'cluster' stanza to the 'build' section of your configuration. For information, see https://skaffold.dev/docs/pipeline-stages/builders/", misc.ArtifactType(a), misc.FormatArtifact(a), misc.ArtifactType(a)),
					Location: cfg.YAMLInfos.Locate(&cfg.Build.Artifacts[i].ArtifactType),
				})
			}
		}
	case bc.GoogleCloudBuild != nil:
		for i, a := range bc.Artifacts {
			at := misc.ArtifactType(a)
			if at != misc.Kaniko && at != misc.Docker && at != misc.Jib && at != misc.Buildpack && at != misc.Ko {
				cfgErrs = append(cfgErrs, ErrorWithLocation{
					Error:    fmt.Errorf("found a '%s' artifact, which is incompatible with the 'gcb' builder:\n\n%s\n\nTo use the '%s' builder, remove the 'googleCloudBuild' stanza from the 'build' section of your configuration. For information, see https://skaffold.dev/docs/pipeline-stages/builders/", misc.ArtifactType(a), misc.FormatArtifact(a), misc.ArtifactType(a)),
					Location: cfg.YAMLInfos.Locate(&cfg.Build.Artifacts[i].ArtifactType),
				})
			}
		}
	case bc.Cluster != nil:
		for i, a := range bc.Artifacts {
			if misc.ArtifactType(a) != misc.Kaniko && misc.ArtifactType(a) != misc.Custom {
				cfgErrs = append(cfgErrs, ErrorWithLocation{

View on GitHub (pinned to a1189de023)

Solutions

  1. Add a `cluster:` stanza under build (and optionally set `build.cluster.pullSecretName`) so kaniko artifacts can build in-cluster
  2. Change the artifact from kaniko to docker if a local build is intended
  3. Remove the kaniko artifact if it is not needed

Example fix

# before
build:
  local: {}
  artifacts:
    - image: myapp
      kaniko: {}
# after
build:
  cluster: {}
  artifacts:
    - image: myapp
      kaniko: {}
Defensive patterns

Strategy: validation

Validate before calling

if (config.build?.local && config.build.artifacts?.some(a => a.kaniko)) {
  throw new Error('kaniko artifacts require build.cluster, not build.local');
}

Type guard

function localBuildCompatible(cfg) {
  return !cfg?.build?.local || !cfg.build.artifacts?.some(a => a.kaniko);
}

Try / catch

try {
  await skaffold.run(config);
} catch (e) {
  if (/incompatible with the 'local' builder/.test(e.message)) {
    console.error('Add a build.cluster stanza or change the artifact type');
  } else throw e;
}

Prevention

When it happens

Trigger: skaffold.yaml has `build.local: {}` while one or more artifacts define `kaniko:`; validated in validateArtifactTypes via ProcessToErrorWithLocation.

Common situations: Merging configs from a cluster-deployment project into a local-dev project, or switching build environments without changing artifact types.

Related errors


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