kubernetes/kops · error

error building compute API client: %v

Error message

error building compute API client: %v

What it means

Wraps compute.NewService failure while constructing the GCE compute API client. Fires when Application Default Credentials cannot be obtained or initialized — missing gcloud auth, no GOOGLE_APPLICATION_CREDENTIALS, or no attached service account.

Source

Thrown at upup/pkg/fi/cloudup/gce/compute.go:56

	Routers() RouterClient
	Instances() InstanceClient
	InstanceTemplates() InstanceTemplateClient
	InstanceGroupManagers() InstanceGroupManagerClient
	TargetPools() TargetPoolClient
	Disks() DiskClient
	RegionBackendServices() RegionBackendServiceClient
}

type computeClientImpl struct {
	srv *compute.Service
}

var _ ComputeClient = (*computeClientImpl)(nil)

func newComputeClientImpl(ctx context.Context) (*computeClientImpl, error) {
	srv, err := compute.NewService(ctx)
	if err != nil {
		return nil, fmt.Errorf("error building compute API client: %v", err)
	}
	return &computeClientImpl{
		srv: srv,
	}, nil
}

func (c *computeClientImpl) Projects() ProjectClient {
	return &projectClientImpl{
		srv: c.srv.Projects,
	}
}

func (c *computeClientImpl) Regions() RegionClient {
	return &regionClientImpl{
		srv: c.srv.Regions,
	}
}

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Run `gcloud auth application-default login` or set GOOGLE_APPLICATION_CREDENTIALS
  2. Verify the credentials file is valid JSON and readable
  3. Check the wrapped error for the ADC failure reason
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at upup/pkg/fi/cloudup/gce/compute.go:56 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/85204c3cae5f9429. Report an issue: GitHub.