{"record":{"id":"0e661ea6316ca7b1","repo":"argoproj/argo-workflows","slug":"failed-to-create-rest-config-w","errorCode":null,"errorMessage":"failed to create REST config: %w","messagePattern":"failed to create REST config: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/auth/gatekeeper.go","lineNumber":345,"sourceCode":"\t}\n\treturn \"Bearer \" + string(secret.Data[\"token\"]), nil\n}\n\nfunc addClaimsLogFields(claims *authTypes.Claims, fields logging.Fields) logging.Fields {\n\tif fields == nil {\n\t\tfields = logging.Fields{}\n\t}\n\tfields[\"subject\"] = claims.Subject\n\tif claims.Email != \"\" {\n\t\tfields[\"email\"] = claims.Email\n\t}\n\treturn fields\n}\n\nfunc DefaultClientForAuthorization(authorization string, config *rest.Config) (*rest.Config, *servertypes.Clients, error) {\n\trestConfig, err := kubeconfig.GetRestConfig(authorization)\n\tif err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"failed to create REST config: %w\", err)\n\t}\n\trestConfig = mergeServerRestConfig(config, restConfig)\n\tdynamicClient, err := dynamic.NewForConfig(restConfig)\n\tif err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"failure to create dynamic client: %w\", err)\n\t}\n\twfClient, err := workflow.NewForConfig(restConfig)\n\tif err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"failure to create workflow client: %w\", err)\n\t}\n\teventsClient, err := events.NewForConfig(restConfig)\n\tif err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"failure to create events client: %w\", err)\n\t}\n\tkubeClient, err := kubernetes.NewForConfig(restConfig)\n\tif err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"failure to create kubernetes client: %w\", err)\n\t}","sourceCodeStart":327,"sourceCodeEnd":363,"githubUrl":"https://github.com/argoproj/argo-workflows/blob/35bff19146f5a6ada77468c431f2624bd577e373/server/auth/gatekeeper.go#L327-L363","documentation":"DefaultClientForAuthorization failed at its first step: kubeconfig.GetRestConfig could not turn the caller's Authorization header into a Kubernetes rest.Config (bad basic-auth token or unsupported scheme). Per-request client construction aborts.","triggerScenarios":"Thrown at server/auth/gatekeeper.go:345 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Send a valid Bearer token or correctly base64-encoded Basic credential","Check the wrapped error for the specific header problem"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"35bff19146f5a6ada77468c431f2624bd577e373","analyzedAt":"2026-09-03T19:34:35.908Z","contentChangedAt":"2026-09-03T19:34:35.908Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}