{"record":{"id":"ecf773100485482d","repo":"googleapis/mcp-toolbox","slug":"failed-to-get-operations-client-w","errorCode":null,"errorMessage":"failed to get operations client: %w","messagePattern":"failed to get operations client: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/sources/serverlessspark/serverlessspark.go","lineNumber":162,"sourceCode":"func (s *Source) GetSessionControllerClient() *dataproc.SessionControllerClient {\n\treturn s.SessionClient\n}\n\nfunc (s *Source) GetOperationsClient(ctx context.Context) (*longrunning.OperationsClient, error) {\n\treturn s.OpsClient, nil\n}\n\nfunc (s *Source) Close() error {\n\treturn errors.Join(s.BatchClient.Close(), s.SessionClient.Close(), s.SessionTemplateClient.Close(), s.OpsClient.Close())\n}\n\nfunc (s *Source) CancelOperation(ctx context.Context, operation string) (any, error) {\n\treq := &longrunningpb.CancelOperationRequest{\n\t\tName: fmt.Sprintf(\"projects/%s/locations/%s/operations/%s\", s.GetProject(), s.GetLocation(), operation),\n\t}\n\tclient, err := s.GetOperationsClient(ctx)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to get operations client: %w\", err)\n\t}\n\terr = client.CancelOperation(ctx, req)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to cancel operation: %w\", err)\n\t}\n\treturn fmt.Sprintf(\"Cancelled [%s].\", operation), nil\n}\n\nfunc (s *Source) CreateBatch(ctx context.Context, batch *dataprocpb.Batch) (map[string]any, error) {\n\treq := &dataprocpb.CreateBatchRequest{\n\t\tParent: fmt.Sprintf(\"projects/%s/locations/%s\", s.GetProject(), s.GetLocation()),\n\t\tBatch:  batch,\n\t}\n\n\tclient := s.GetBatchControllerClient()\n\top, err := client.CreateBatch(ctx, req)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to create batch: %w\", err)","sourceCodeStart":144,"sourceCodeEnd":180,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/sources/serverlessspark/serverlessspark.go#L144-L180","documentation":"GetOperationsClient, which normally just returns the pre-initialized s.OpsClient, returned an error inside CancelOperation; this is a defensive guard since the current implementation always returns nil error — failure here means the stored client is unusable.","triggerScenarios":"Thrown at internal/sources/serverlessspark/serverlessspark.go:162 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check whether the source was fully initialized (all clients created in Initialize)","Recreate/reinitialize the Serverless Spark source if its clients were closed","Inspect the wrapped error for the underlying Google API cause"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"8cc6e09de2ad7b8bffc77751799585a1401a48eb","analyzedAt":"2026-09-05T01:10:36.887Z","contentChangedAt":"2026-09-05T01:10:36.887Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}