kubernetes/kops · error

failed to create Linode client: %w

Error message

failed to create Linode client: %w

What it means

After reading the token, NewCloud initializes the API client with linodego.NewClient(nil). If the client library cannot construct its default HTTP client (e.g. OAuth2 transport creation fails), the error is wrapped as 'failed to create Linode client: %w'.

Source

Thrown at upup/pkg/fi/cloudup/linode/cloud.go:95

}

var _ LinodeCloud = &Cloud{}

var invalidLinodeLabelChars = regexp.MustCompile(`[^A-Za-z0-9_-]+`)

func NewCloud(region string) (LinodeCloud, error) {
	if region == "" {
		return nil, fmt.Errorf("region is required")
	}

	accessToken := os.Getenv("LINODE_TOKEN")
	if accessToken == "" {
		return nil, fmt.Errorf("%s is required", "LINODE_TOKEN")
	}

	client, err := linodego.NewClient(nil)
	if err != nil {
		return nil, fmt.Errorf("failed to create Linode client: %w", err)
	}
	client.SetUserAgent("kops/" + kopsv.Version)
	client.SetToken(accessToken)

	return &Cloud{
		region: region,
		client: &client,
	}, nil
}

func (c *Cloud) Client() LinodeClient {
	return c.client
}

func (c *Cloud) ProviderID() kops.CloudProviderID {
	return kops.CloudProviderLinode
}

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Inspect the wrapped %w cause with `kops ... -v=10` to see the underlying linodego error.
  2. Run `make gomod` / `go mod tidy` to align linodego with the version in go.mod, then rebuild kops.
  3. Retry in a normal environment (check for tampered CA certs / proxy settings like HTTP(S)_PROXY that break client construction).
Defensive patterns

Strategy: try-catch

Try / catch

cloud, err := BuildCloud(...)
if err != nil {
	var inner error
	if errors.As(err, &inner) && strings.Contains(err.Error(), "failed to create Linode client") {
		log.Printf("linodego client init failed: %v", inner) // then rebuild deps / retry
	}
}

Prevention

When it happens

Trigger: linodego.NewClient(nil) returns a non-nil error during cloud construction in BuildCloud — rare, typically from an internal OAuth2/transport failure in linodego.

Common situations: Incompatible or broken linodego dependency version in the build; extremely restricted runtime environments where the default HTTP transport cannot be allocated.

Related errors


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