{"record":{"id":"cc4bb5721cf015b9","repo":"GoogleContainerTools/skaffold","slug":"statuscode-deploy-cloud-run-get-worker-pool-err","errorCode":"StatusCode_DEPLOY_CLOUD_RUN_GET_WORKER_POOL_ERR","errorMessage":"error checking Cloud Run State: %w","messagePattern":"error checking Cloud Run State: %w","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/skaffold/deploy/cloudrun/deploy.go","lineNumber":459,"sourceCode":"\t\t\tworkerpool.Spec.Template.Metadata.Labels[\"run-id\"] = runID\n\t\t}\n\t}\n\tresName := RunResourceName{\n\t\tProject:    workerpool.Metadata.Namespace,\n\t\tRegion:     d.Region,\n\t\tWorkerPool: workerpool.Metadata.Name,\n\t}\n\toutput.Default.Fprintln(out, \"Deploying Cloud Run WorkerPool:\\n\\t\", workerpool.Metadata.Name)\n\tparent := fmt.Sprintf(\"namespaces/%s\", workerpool.Metadata.Namespace)\n\n\twpName := resName.String()\n\tgetCall := crclient.Namespaces.Workerpools.Get(wpName)\n\t_, err := getCall.Do()\n\n\tif err != nil {\n\t\tgErr, ok := err.(*googleapi.Error)\n\t\tif !ok || gErr.Code != http.StatusNotFound {\n\t\t\treturn nil, sErrors.NewError(fmt.Errorf(\"error checking Cloud Run State: %w\", err), &proto.ActionableErr{\n\t\t\t\tMessage: err.Error(),\n\t\t\t\tErrCode: proto.StatusCode_DEPLOY_CLOUD_RUN_GET_WORKER_POOL_ERR,\n\t\t\t})\n\t\t}\n\t\t// This is a new workerpool, we need to create it\n\t\tcreateCall := crclient.Namespaces.Workerpools.Create(parent, workerpool)\n\t\t_, err = createCall.Do()\n\t} else {\n\t\treplaceCall := crclient.Namespaces.Workerpools.ReplaceWorkerPool(wpName, workerpool)\n\t\t_, err = replaceCall.Do()\n\t}\n\tif err != nil {\n\t\treturn nil, sErrors.NewError(fmt.Errorf(\"error deploying Cloud Run WorkerPool: %s\", err), &proto.ActionableErr{\n\t\t\tMessage: err.Error(),\n\t\t\tErrCode: proto.StatusCode_DEPLOY_CLOUD_RUN_UPDATE_WORKER_POOL_ERR,\n\t\t})\n\t}\n\treturn &resName, nil","sourceCodeStart":441,"sourceCodeEnd":477,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/pkg/skaffold/deploy/cloudrun/deploy.go#L441-L477","documentation":"deployWorkerPool probes for an existing WorkerPool with crclient.Namespaces.Workerpools.Get(wpName). Any error other than googleapi 404 (which is treated as 'create a new pool') is wrapped as DEPLOY_CLOUD_RUN_GET_WORKER_POOL_ERR, because skaffold cannot establish the WorkerPool's current state.","triggerScenarios":"Workerpools.Get fails with 403 permission denied, 429 quota exceeded, 5xx server error, or a transport/auth error rather than a clean 404.","commonSituations":"Missing IAM roles for WorkerPools (roles/run.developer or preview roles for the WorkerPool alpha); Cloud Run API not enabled; wrong region endpoint; network/firewall blocking googleapis.com; transient control-plane errors.","solutions":["Grant the caller the required Cloud Run WorkerPool IAM permissions","Enable run.googleapis.com on the target project","Verify the region/endpoint configuration matches where the WorkerPool lives","Inspect the wrapped googleapi.Error code and retry transient 5xx"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// verify WorkerPool reachability before deploy\nname := fmt.Sprintf(\"projects/%s/locations/%s/workerpools/%s\", project, region, wpName)\nif _, err := runSvc.Projects.Locations.Workerpools.Get(name).Do(); err != nil {\n    var gErr *googleapi.Error\n    if errors.As(err, &gErr) && gErr.Code != 404 {\n        return fmt.Errorf(\"cannot reach WorkerPool API (code %d): %w\", gErr.Code, err)\n    }\n}","typeGuard":"func isWorkerPoolNotFound(err error) bool {\n    gErr, ok := err.(*googleapi.Error)\n    return ok && gErr.Code == http.StatusNotFound\n}","tryCatchPattern":"err := deployWorkerPool(crclient, manifest, out)\nif err != nil {\n    var gErr *googleapi.Error\n    if errors.As(err, &gErr) {\n        if gErr.Code == 403 {\n            return fmt.Errorf(\"grant WorkerPool IAM permissions: %w\", err)\n        }\n        if gErr.Code >= 500 || gErr.Code == 429 {\n            return retry.WithBackoff(ctx, deploy)\n        }\n    }\n    return err\n}","preventionTips":["Grant roles/run.developer including WorkerPool scopes","Enable the Cloud Run API (and WorkerPool access if alpha) for the project","Confirm correct region endpoint in deploy config","Back off and retry on 429/5xx responses"],"tags":["cloud-run","workerpool","gcp-api","iam"],"backgroundTag":"cloud-run-api-call-failed","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"}