{"record":{"id":"bc8ede3085eb5bda","repo":"GoogleContainerTools/skaffold","slug":"invalid-value-for-worker-pool-must-match-pattern","errorCode":null,"errorMessage":"invalid value for worker pool. Must match pattern projects/{project}/locations/{location}/workerPools/{worker_pool}","messagePattern":"invalid value for worker pool\\. Must match pattern projects/(.+?)/locations/(.+?)/workerPools/(.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/skaffold/schema/validation/validation.go","lineNumber":683,"sourceCode":"\tcase bc.Cluster != nil:\n\t\tfor i, a := range bc.Artifacts {\n\t\t\tif misc.ArtifactType(a) != misc.Kaniko && misc.ArtifactType(a) != misc.Custom {\n\t\t\t\tcfgErrs = append(cfgErrs, ErrorWithLocation{\n\t\t\t\t\tError:    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)),\n\t\t\t\t\tLocation: cfg.YAMLInfos.Locate(&cfg.Build.Artifacts[i].ArtifactType),\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\t}\n\treturn cfgErrs\n}\n\n// validateGCBConfig checks if GCB config is valid.\nfunc validateGCBConfig(cfg *parser.SkaffoldConfigEntry, bc latest.BuildConfig) (cfgErrs []ErrorWithLocation) {\n\tif bc.GoogleCloudBuild != nil && bc.GoogleCloudBuild.WorkerPool != \"\" {\n\t\tif !gcbWorkerPoolPattern.MatchString(bc.GoogleCloudBuild.WorkerPool) {\n\t\t\tcfgErrs = append(cfgErrs, ErrorWithLocation{\n\t\t\t\tError:    fmt.Errorf(\"invalid value for worker pool. Must match pattern projects/{project}/locations/{location}/workerPools/{worker_pool}\"),\n\t\t\t\tLocation: cfg.YAMLInfos.Locate(&cfg.Build.GoogleCloudBuild.WorkerPool),\n\t\t\t})\n\t\t}\n\t}\n\treturn cfgErrs\n}\n\n// validateLogPrefix checks that logs are configured with a valid prefix.\nfunc validateLogPrefix(cfg *parser.SkaffoldConfigEntry, lc latest.LogsConfig) []ErrorWithLocation {\n\tvalidPrefixes := []string{\"\", \"auto\", \"container\", \"podAndContainer\", \"none\"}\n\n\tif !stringslice.Contains(validPrefixes, lc.Prefix) {\n\t\treturn []ErrorWithLocation{\n\t\t\t{\n\t\t\t\tError:    fmt.Errorf(\"invalid log prefix '%s'. Valid values are 'auto', 'container', 'podAndContainer' or 'none'\", lc.Prefix),\n\t\t\t\tLocation: cfg.YAMLInfos.Locate(&cfg.Deploy.Logs),\n\t\t\t},\n\t\t}","sourceCodeStart":665,"sourceCodeEnd":701,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/pkg/skaffold/schema/validation/validation.go#L665-L701","documentation":"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.","triggerScenarios":"build.googleCloudBuild.workerPool set to a value not matching the gcbWorkerPoolPattern regex; validated in validateGCBConfig.","commonSituations":"Setting just the worker pool name ('my-pool') or a regional path missing the project, copied from gcloud output that was truncated.","solutions":["Set workerPool to the full resource path, e.g. projects/my-project/locations/us-central1/workerPools/my-pool","Copy the resource name from `gcloud builds worker-pools describe` output","Clear the workerPool field to use the default Cloud Build pool"],"exampleFix":"# before\nbuild:\n  googleCloudBuild:\n    projectId: my-project\n    workerPool: my-pool\n# after\nbuild:\n  googleCloudBuild:\n    projectId: my-project\n    workerPool: projects/my-project/locations/us-central1/workerPools/my-pool","handlingStrategy":"validation","validationCode":"const re = /^projects\\/[^/]+\\/locations\\/[^/]+\\/workerPools\\/[^/]+$/;\nconst wp = config.build?.googleCloudBuild?.workerPool;\nif (wp && !re.test(wp)) throw new Error(`workerPool '${wp}' must match projects/{project}/locations/{location}/workerPools/{worker_pool}`);","typeGuard":"function hasValidWorkerPool(cfg) {\n  const wp = cfg?.build?.googleCloudBuild?.workerPool;\n  return !wp || /^projects\\/[^/]+\\/locations\\/[^/]+\\/workerPools\\/[^/]+$/.test(wp);\n}","tryCatchPattern":"try {\n  await skaffold.run(config);\n} catch (e) {\n  if (/invalid value for worker pool/.test(e.message)) {\n    console.error('Use the full worker pool resource path from gcloud builds worker-pools');\n  } else throw e;\n}","preventionTips":["Copy the full resource path from `gcloud builds worker-pools describe/list`","Never abbreviate workerPool to just the pool name","Add a regex lint rule for workerPool in your config linter"],"tags":["skaffold","config-validation","google-cloud-build","worker-pool"],"backgroundTag":"skaffold-config-validation","analyzedSha":"a1189de023efc32d4b8e11f395acc678aa555011","analyzedAt":"2026-09-05T12:09:27.064Z","contentChangedAt":"2026-09-05T12:09:27.064Z","schemaVersion":2},"datasetVersion":"2026-09-12T17:17:11.597Z"}