GoogleContainerTools/skaffold · error

invalid value for worker pool. Must match pattern projects/{

Error message

invalid value for worker pool. Must match pattern projects/{project}/locations/{location}/workerPools/{worker_pool}

What it means

The googleCloudBuild.workerPool field must be a fully qualified Cloud Build worker pool resource name matching projects/{project}/locations/{location}/workerPools/{worker_pool}. Any other format (short name, partial path) fails validation because the Cloud Build API requires the full resource path.

Source

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

	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{
					Error:    fmt.Errorf("found a '%s' artifact, which is incompatible with the 'cluster' builder:\n\n%s\n\nTo use the '%s' builder, remove the 'cluster' 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),
				})
			}
		}
	}
	return cfgErrs
}

// validateGCBConfig checks if GCB config is valid.
func validateGCBConfig(cfg *parser.SkaffoldConfigEntry, bc latest.BuildConfig) (cfgErrs []ErrorWithLocation) {
	if bc.GoogleCloudBuild != nil && bc.GoogleCloudBuild.WorkerPool != "" {
		if !gcbWorkerPoolPattern.MatchString(bc.GoogleCloudBuild.WorkerPool) {
			cfgErrs = append(cfgErrs, ErrorWithLocation{
				Error:    fmt.Errorf("invalid value for worker pool. Must match pattern projects/{project}/locations/{location}/workerPools/{worker_pool}"),
				Location: cfg.YAMLInfos.Locate(&cfg.Build.GoogleCloudBuild.WorkerPool),
			})
		}
	}
	return cfgErrs
}

// validateLogPrefix checks that logs are configured with a valid prefix.
func validateLogPrefix(cfg *parser.SkaffoldConfigEntry, lc latest.LogsConfig) []ErrorWithLocation {
	validPrefixes := []string{"", "auto", "container", "podAndContainer", "none"}

	if !stringslice.Contains(validPrefixes, lc.Prefix) {
		return []ErrorWithLocation{
			{
				Error:    fmt.Errorf("invalid log prefix '%s'. Valid values are 'auto', 'container', 'podAndContainer' or 'none'", lc.Prefix),
				Location: cfg.YAMLInfos.Locate(&cfg.Deploy.Logs),
			},
		}

View on GitHub (pinned to a1189de023)

Solutions

  1. Set workerPool to the full resource path, e.g. projects/my-project/locations/us-central1/workerPools/my-pool
  2. Copy the resource name from `gcloud builds worker-pools describe` output
  3. Clear the workerPool field to use the default Cloud Build pool

Example fix

# before
build:
  googleCloudBuild:
    projectId: my-project
    workerPool: my-pool
# after
build:
  googleCloudBuild:
    projectId: my-project
    workerPool: projects/my-project/locations/us-central1/workerPools/my-pool
Defensive patterns

Strategy: validation

Validate before calling

const re = /^projects\/[^/]+\/locations\/[^/]+\/workerPools\/[^/]+$/;
const wp = config.build?.googleCloudBuild?.workerPool;
if (wp && !re.test(wp)) throw new Error(`workerPool '${wp}' must match projects/{project}/locations/{location}/workerPools/{worker_pool}`);

Type guard

function hasValidWorkerPool(cfg) {
  const wp = cfg?.build?.googleCloudBuild?.workerPool;
  return !wp || /^projects\/[^/]+\/locations\/[^/]+\/workerPools\/[^/]+$/.test(wp);
}

Try / catch

try {
  await skaffold.run(config);
} catch (e) {
  if (/invalid value for worker pool/.test(e.message)) {
    console.error('Use the full worker pool resource path from gcloud builds worker-pools');
  } else throw e;
}

Prevention

When it happens

Trigger: build.googleCloudBuild.workerPool set to a value not matching the gcbWorkerPoolPattern regex; validated in validateGCBConfig.

Common situations: Setting just the worker pool name ('my-pool') or a regional path missing the project, copied from gcloud output that was truncated.

Related errors


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