kubernetes/kops · error

error building compute API client: %v

Error message

error building compute API client: %v

What it means

NewGCECloud wraps newComputeClientImpl failure while building the region/project-scoped GCE cloud instance. It fires when the Compute API service cannot be created (credential resolution failure, GOOGLE_APPLICATION_CREDENTIALS pointing to an invalid file); without compute access the cloud object is useless, so construction aborts.

Source

Thrown at upup/pkg/fi/cloudup/gce/gce_cloud.go:144

	i := gceCloudInstances[region+"::"+project]
	gceCloudInstancesMapMutex.RUnlock()
	if i != nil {
		return i.(gceCloudInternal).WithLabels(labels), nil
	}

	klog.V(2).Infof("Building new GCE cloud instance for region %q and project %q", region, project)

	c := &gceCloudImplementation{region: region, project: project}

	ctx := context.Background()

	if os.Getenv("GOOGLE_APPLICATION_CREDENTIALS") != "" {
		klog.Infof("Will load GOOGLE_APPLICATION_CREDENTIALS from %s", os.Getenv("GOOGLE_APPLICATION_CREDENTIALS"))
	}

	computeClient, err := newComputeClientImpl(ctx)
	if err != nil {
		return nil, fmt.Errorf("error building compute API client: %v", err)
	}
	c.compute = computeClient

	storageClient, err := storage.NewClient(ctx)
	if err != nil {
		return nil, fmt.Errorf("error building storage API client: %v", err)
	}
	c.storage = storageClient

	iamService, err := newIamClientImpl(ctx)
	if err != nil {
		return nil, fmt.Errorf("error building IAM API client: %v", err)
	}
	c.iam = iamService

	dnsClient, err := newDNSClientImpl(ctx)
	if err != nil {
		return nil, fmt.Errorf("error building DNS API client: %v", err)

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Configure ADC (gcloud auth application-default login or GOOGLE_APPLICATION_CREDENTIALS)
  2. Verify the service account has compute read scope
  3. Check the wrapped error for details
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at upup/pkg/fi/cloudup/gce/gce_cloud.go:144 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05). Data as JSON: /api/errors/f3f3636b61b43487. Report an issue: GitHub.