{"record":{"id":"b83200697135c3a5","repo":"kubernetes/kops","slug":"building-instance-metadata-request-w","errorCode":null,"errorMessage":"building instance metadata request: %w","messagePattern":"building instance metadata request: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/linode/linodemetadata/authenticator.go","lineNumber":104,"sourceCode":"\tdefer tokenResp.Body.Close()\n\n\tif tokenResp.StatusCode != http.StatusOK {\n\t\treturn \"\", fmt.Errorf(\"fetching metadata token: unexpected status code %d\", tokenResp.StatusCode)\n\t}\n\n\ttokenBytes, err := io.ReadAll(tokenResp.Body)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"reading metadata token response: %w\", err)\n\t}\n\n\ttoken := strings.TrimSpace(string(tokenBytes))\n\tif token == \"\" {\n\t\treturn \"\", fmt.Errorf(\"metadata token was empty\")\n\t}\n\n\tinstanceReq, err := http.NewRequestWithContext(ctx, http.MethodGet, metadataBaseURL+\"/v1/instance\", nil)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"building instance metadata request: %w\", err)\n\t}\n\tinstanceReq.Header.Set(\"Metadata-Token\", token)\n\n\tinstanceResp, err := client.Do(instanceReq)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"fetching instance metadata: %w\", err)\n\t}\n\tdefer instanceResp.Body.Close()\n\n\tif instanceResp.StatusCode != http.StatusOK {\n\t\treturn \"\", fmt.Errorf(\"fetching instance metadata: unexpected status code %d\", instanceResp.StatusCode)\n\t}\n\n\tinstanceBytes, err := io.ReadAll(instanceResp.Body)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"reading instance metadata response: %w\", err)\n\t}\n","sourceCodeStart":86,"sourceCodeEnd":122,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/linode/linodemetadata/authenticator.go#L86-L122","documentation":"getLinodeMetadataValue wraps the http.NewRequestWithContext error when constructing the GET /v1/instance request that carries the metadata token. Like the token-request build error, it only fires on an invalid URL/method, i.e. a malformed metadataBaseURL.","triggerScenarios":"Thrown at upup/pkg/fi/cloudup/linode/linodemetadata/authenticator.go:104 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Validate metadataBaseURL is a well-formed absolute URL","Fix the configuration/code defect rather than retrying, since the error is deterministic"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T12:17:11.808Z"}