{"record":{"id":"5fe0762ca2366c04","repo":"kubernetes/kops","slug":"reading-sts-response-v","errorCode":null,"errorMessage":"reading STS response: %v","messagePattern":"reading STS response: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/bootstrap/awsbootstrap/verifier.go","lineNumber":421,"sourceCode":"\t\treturn nil, fmt.Errorf(\"url not valid for STS request\")\n\t}\n\n\treq := &http.Request{\n\t\tURL:    reqURL,\n\t\tMethod: decoded.Method,\n\t\tHeader: decoded.SignedHeader,\n\t}\n\tresponse, err := httpClient.Do(req)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"sending STS request: %v\", err)\n\t}\n\tif response != nil {\n\t\tdefer response.Body.Close()\n\t}\n\n\tresponseBody, err := io.ReadAll(response.Body)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"reading STS response: %v\", err)\n\t}\n\tif response.StatusCode != 200 {\n\t\treturn nil, fmt.Errorf(\"received status code %d from STS: %s\", response.StatusCode, string(responseBody))\n\t}\n\n\tcallerIdentity := &GetCallerIdentityResponse{}\n\terr = xml.NewDecoder(bytes.NewReader(responseBody)).Decode(callerIdentity)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"decoding STS response: %v\", err)\n\t}\n\n\treturn callerIdentity, nil\n}\n\n// GetCallerIdentityV1 will request the presigned token URL, and decode the returned identity.\nfunc (s *stsRequestValidator) getCallerIdentityV1(ctx context.Context, httpClient *http.Client, decoded awsV1Token) (*GetCallerIdentityResponse, error) {\n\t// Well-known V1 request body\n\tbody := []byte(\"Action=GetCallerIdentity&Version=2011-06-15\")","sourceCodeStart":403,"sourceCodeEnd":439,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/pkg/bootstrap/awsbootstrap/verifier.go#L403-L439","documentation":"getCallerIdentityV2 wraps io.ReadAll failure on the STS HTTP response body. The request itself succeeded at transport level, but the body could not be read (connection reset mid-response, truncated stream), so caller identity cannot be extracted.","triggerScenarios":"Thrown at pkg/bootstrap/awsbootstrap/verifier.go:421 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Retry the request","Check for proxies truncating responses","Verify STS endpoint connectivity"],"exampleFix":null,"handlingStrategy":"retry","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-12T07:17:12.445Z"}