{"record":{"id":"91d185386d3ee2ed","repo":"argoproj/argo-workflows","slug":"failure-to-create-events-client-w","errorCode":null,"errorMessage":"failure to create events client: %w","messagePattern":"failure to create events client: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/auth/gatekeeper.go","lineNumber":358,"sourceCode":"}\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}\n\treturn restConfig, &servertypes.Clients{\n\t\tDynamic:    dynamicClient,\n\t\tWorkflow:   wfClient,\n\t\tEvents:     eventsClient,\n\t\tKubernetes: kubeClient,\n\t}, nil\n}\n\nfunc mergeServerRestConfig(argoServerConfig *rest.Config, newConfig *rest.Config) *rest.Config {\n\tnewConfig.Burst = argoServerConfig.Burst\n\tnewConfig.QPS = argoServerConfig.QPS\n\tnewConfig.UserAgent = argoServerConfig.UserAgent\n\t// TO DO: Merge other common configurations，such as RateLimiter.","sourceCodeStart":340,"sourceCodeEnd":376,"githubUrl":"https://github.com/argoproj/argo-workflows/blob/35bff19146f5a6ada77468c431f2624bd577e373/server/auth/gatekeeper.go#L340-L376","documentation":"DefaultClientForAuthorization wraps the error from constructing the Kubernetes events clientset (eventsv1.NewForConfig) after the REST config has been built from the caller's authorization token. It fires during 'client' auth mode when the merged rest config is unusable for the events client — e.g. malformed host/CA or an invalid token format — aborting the request before the gatekeeper installs per-request clients.","triggerScenarios":"Thrown at server/auth/gatekeeper.go:358 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the wrapped error; usually the rest.Config host/CA data is malformed","Fix server kubeconfig settings"],"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"}