GoogleContainerTools/skaffold · error
StatusCode_DEPLOY_GET_CLOUD_RUN_CLIENT_ERR
StatusCode_DEPLOY_GET_CLOUD_RUN_CLIENT_ERR
Error message
unable to create Cloud Run Client
What it means
cleanupRun builds a Cloud Run API client via run.NewService(ctx, cOptions...) before deleting resources. If client construction fails (bad options, transport setup, credential initialization), this DEPLOY_GET_CLOUD_RUN_CLIENT_ERR is returned and cleanup cannot proceed.
Source
Thrown at pkg/skaffold/deploy/cloudrun/deploy.go:489
if err != nil {
return nil, sErrors.NewError(fmt.Errorf("error deploying Cloud Run WorkerPool: %s", err), &proto.ActionableErr{
Message: err.Error(),
ErrCode: proto.StatusCode_DEPLOY_CLOUD_RUN_UPDATE_WORKER_POOL_ERR,
})
}
return &resName, nil
}
func (d *Deployer) cleanupRun(ctx context.Context, out io.Writer, dryRun bool, manifests manifest.ManifestList) error {
var errors []error
cOptions := d.clientOptions
if d.useGcpOptions {
cOptions = append(cOptions, option.WithEndpoint(fmt.Sprintf("%s-run.googleapis.com", d.Region)))
cOptions = append(gcp.ClientOptions(ctx), cOptions...)
}
crclient, err := run.NewService(ctx, cOptions...)
if err != nil {
return sErrors.NewError(fmt.Errorf("unable to create Cloud Run Client"), &proto.ActionableErr{
Message: err.Error(),
ErrCode: proto.StatusCode_DEPLOY_GET_CLOUD_RUN_CLIENT_ERR,
})
}
for _, manifest := range manifests {
tpe, err := getTypeFromManifest(manifest)
switch {
case err != nil:
errors = append(errors, err)
case tpe == typeService:
err := d.deleteRunService(crclient, out, dryRun, manifest)
if err != nil {
errors = append(errors, err)
}
case tpe == typeJob:
err := d.deleteRunJob(crclient, out, dryRun, manifest)
if err != nil {
errors = append(errors, err)View on GitHub (pinned to a1189de023)
Solutions
- Verify the region is set in skaffold.yaml so the endpoint is a valid "<region>-run.googleapis.com"
- Set up Application Default Credentials: `gcloud auth application-default login` or GOOGLE_APPLICATION_CREDENTIALS in CI
- Check the context is not cancelled/expired before cleanup
- Confirm gcloud configuration and network reachability to googleapis.com
Example fix
// before (skaffold.yaml missing region)
deploy:
cloudrun:
project: my-project
// after
deploy:
cloudrun:
project: my-project
region: us-central1 Defensive patterns
Strategy: validation
Validate before calling
func preflightCloudRunClient(region, project string) error {
if region == "" {
return fmt.Errorf("region must be set; endpoint would be \"-run.googleapis.com\"")
}
creds, err := google.FindDefaultCredentials(context.Background(), run.CloudPlatformScope)
if err != nil {
return fmt.Errorf("no valid Application Default Credentials: %w", err)
}
return nil
} Type guard
func canBuildClient(opts []option.ClientOption) bool {
_, err := run.NewService(context.Background(), opts...)
return err == nil
} Try / catch
err := deployer.Cleanup(ctx, out)
if err != nil {
var actionErr *sErrors.Error
if errors.As(err, &actionErr) && actionErr.ErrCode == proto.StatusCode_DEPLOY_GET_CLOUD_RUN_CLIENT_ERR {
// fix credentials/region, then retry cleanup
}
return err
} Prevention
- Always configure region in skaffold.yaml cloud-run deploy
- Set up ADC via `gcloud auth application-default login` or service-account key in CI
- Verify GOOGLE_APPLICATION_CREDENTIALS points to a valid key file
- Ensure the context passed to cleanup is not already cancelled
When it happens
Trigger: run.NewService returns an error: invalid option.WithEndpoint value (e.g. malformed region producing "-run.googleapis.com"), failure assembling gcp.ClientOptions (bad ADC/credentials), or nil/failed context deadline.
Common situations: Region left empty so the endpoint becomes "-run.googleapis.com"; no Application Default Credentials available (CI without GOOGLE_APPLICATION_CREDENTIALS); corrupted gcloud credentials; ctx cancelled before client creation.
Related errors
- INIT_CLOUD_RUN_LOCATION_ERROR
- StatusCode_DEPLOY_CLOUD_RUN_DELETE_SERVICE_ERR
- StatusCode_DEPLOY_CLOUD_RUN_DELETE_WORKER_POOL_ERR
- error getting google authenticator
- retrieving gcloud access token: %w
AI-assisted analysis of GoogleContainerTools/skaffold@a1189de023 (2026-09-05).
Data as JSON: /api/errors/514d22236fb29952.
Report an issue: GitHub.