{"record":{"id":"663c1414c2b3f682","repo":"kubernetes/kops","slug":"failed-to-create-linode-client-w-663c14","errorCode":null,"errorMessage":"failed to create Linode client: %w","messagePattern":"failed to create Linode client: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/linode/verifier.go","lineNumber":55,"sourceCode":"\tGetInstance(ctx context.Context, linodeID int) (*linodego.Instance, error)\n}\n\ntype linodeVerifier struct {\n\tclient linodeVerifierClient\n}\n\nvar _ bootstrap.Verifier = (*linodeVerifier)(nil)\n\n// NewLinodeVerifier returns a bootstrap.Verifier that can verify Akamai (Linode) instance tokens using the LINODE_TOKEN environment variable.\nfunc NewLinodeVerifier(opt *LinodeVerifierOptions) (bootstrap.Verifier, error) {\n\taccessToken := os.Getenv(\"LINODE_TOKEN\")\n\tif accessToken == \"\" {\n\t\treturn nil, fmt.Errorf(\"%s is required\", \"LINODE_TOKEN\")\n\t}\n\n\tclient, err := linodego.NewClient(nil)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to create Linode client: %w\", err)\n\t}\n\tclient.SetUserAgent(\"kops\")\n\tclient.SetToken(accessToken)\n\n\treturn &linodeVerifier{client: &client}, nil\n}\n\n// VerifyToken verifies that the given token corresponds to a valid Akamai (Linode) instance.\nfunc (v *linodeVerifier) VerifyToken(ctx context.Context, rawRequest *http.Request, token string, body []byte) (*bootstrap.VerifyResult, error) {\n\tif !strings.HasPrefix(token, linodemetadata.LinodeAuthenticationTokenPrefix) {\n\t\treturn nil, bootstrap.ErrNotThisVerifier\n\t}\n\n\tinstanceIDString := strings.TrimPrefix(token, linodemetadata.LinodeAuthenticationTokenPrefix)\n\tinstanceID, err := strconv.Atoi(instanceIDString)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"invalid authorization token\")\n\t}","sourceCodeStart":37,"sourceCodeEnd":73,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/linode/verifier.go#L37-L73","documentation":"After validating the token, NewLinodeVerifier constructs an API client via linodego.NewClient(nil). If the underlying linodego library cannot initialize its client (rare; typically an internal init failure in the SDK), the error is wrapped with this message. This is distinct from authentication failures — it happens before any HTTP call is made.","triggerScenarios":"linodego.NewClient(nil) returns a non-nil err. This occurs only when the linodego SDK's internal client construction fails (SDK-internal issue, e.g. broken default HTTP client setup), not from bad tokens.","commonSituations":"Pinned/old or vendored linodego version with a client-construction regression; exotic environments where the SDK's default transport setup fails; seen almost exclusively during SDK upgrades or dependency mismatches.","solutions":["Check the wrapped (%w) cause from linodego for the actual initialization failure","Update or align the linodego dependency version (go get go.linode.com/linodego@latest && make gomod)","Construct the client manually (linodego.NewClient(&http.Client{...})) to bypass the failing default and isolate the cause","Pin a known-good linodego version if the regression appeared after a dependency bump"],"exampleFix":"// before\nclient, err := linodego.NewClient(nil)\nif err != nil {\n\treturn nil, fmt.Errorf(\"failed to create Linode client: %w\", err)\n}\n// after\nhttpClient := &http.Client{Timeout: 30 * time.Second}\nclient, err := linodego.NewClient(httpClient)\nif err != nil {\n\treturn nil, fmt.Errorf(\"failed to create Linode client: %w\", err)\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"client, err := linodego.NewClient(nil)\nif err != nil {\n\treturn fmt.Errorf(\"failed to create Linode client: %w\", err)\n}","preventionTips":["Keep the linodego dependency current and consistent across modules","Surface the wrapped cause instead of hiding it in logs","Pin known-good SDK versions in go.mod","If it persists, construct the client with an explicit *http.Client"],"tags":["linode","sdk","linodego","client-init"],"backgroundTag":"sdk-client-init-failed","analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T07:17:12.445Z"}