{"record":{"id":"3cf8118b1594398a","repo":"k3s-io/k3s","slug":"s-s-3cf811","errorCode":null,"errorMessage":"%s: %s","messagePattern":"%s: %s","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/clientaccess/token.go","lineNumber":549,"sourceCode":"\tdefer resp.Body.Close()\n\tb, err := io.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\twarnings, _ := net.ParseWarningHeaders(resp.Header[\"Warning\"])\n\tfor _, warning := range warnings {\n\t\tif warning.Code == 299 && len(warning.Text) != 0 {\n\t\t\tlogrus.Warnf(\"%s\", warning.Text)\n\t\t}\n\t}\n\n\tif resp.StatusCode < 200 || resp.StatusCode > 299 {\n\t\tstatus := metav1.Status{}\n\t\tif err := json.Unmarshal(b, &status); err == nil && status.Kind == \"Status\" {\n\t\t\treturn nil, &apierrors.StatusError{ErrStatus: status}\n\t\t}\n\t\treturn nil, fmt.Errorf(\"%s: %s\", resp.Request.URL, resp.Status)\n\t}\n\treturn b, nil\n}\n\n// FormatToken takes a username:password string or join token, and a path to a certificate bundle, and\n// returns a string containing the full K10 format token string. If the credentials are\n// empty, an empty token is returned. If the certificate bundle does not exist or does not\n// contain a valid bundle, an error is returned.\nfunc FormatToken(creds, certFile string) (string, error) {\n\tif len(creds) == 0 {\n\t\treturn \"\", nil\n\t}\n\n\tb, err := os.ReadFile(certFile)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn FormatTokenBytes(creds, b)","sourceCodeStart":531,"sourceCodeEnd":567,"githubUrl":"https://github.com/k3s-io/k3s/blob/6ba341e396edc16b8dcae978a7c5e3ac7ee5606e/pkg/clientaccess/token.go#L531-L567","documentation":"Error \"%s: %s\" thrown in k3s-io/k3s.","triggerScenarios":"Thrown at pkg/clientaccess/token.go:549 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"6ba341e396edc16b8dcae978a7c5e3ac7ee5606e","analyzedAt":"2026-08-15T16:27:54.286Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}