{"record":{"id":"95b47b01c22b05bd","repo":"googleapis/mcp-toolbox","slug":"failed-to-list-batches-w","errorCode":null,"errorMessage":"failed to list batches: %w","messagePattern":"failed to list batches: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/sources/serverlessspark/serverlessspark.go","lineNumber":244,"sourceCode":"\t}\n\n\tif ps != nil {\n\t\treq.PageSize = int32(*ps)\n\t}\n\tif pt != \"\" {\n\t\treq.PageToken = pt\n\t}\n\tif filter != \"\" {\n\t\treq.Filter = filter\n\t}\n\n\tit := client.ListBatches(ctx, req)\n\tpager := iterator.NewPager(it, int(req.PageSize), req.PageToken)\n\n\tvar batchPbs []*dataprocpb.Batch\n\tnextPageToken, err := pager.NextPage(&batchPbs)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to list batches: %w\", err)\n\t}\n\n\tbatches, err := ToBatches(batchPbs)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn ListBatchesResponse{Batches: batches, NextPageToken: nextPageToken}, nil\n}\n\n// ToBatches converts a slice of protobuf Batch messages to a slice of Batch structs.\nfunc ToBatches(batchPbs []*dataprocpb.Batch) ([]Batch, error) {\n\tbatches := make([]Batch, 0, len(batchPbs))\n\tfor _, batchPb := range batchPbs {\n\t\tconsoleUrl, err := BatchConsoleURLFromProto(batchPb)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error generating console url: %v\", err)\n\t\t}","sourceCodeStart":226,"sourceCodeEnd":262,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/sources/serverlessspark/serverlessspark.go#L226-L262","documentation":"The paginated Dataproc ListBatches RPC (pager.NextPage) failed while fetching batches — invalid page token/filter, permissions, or a transient API error.","triggerScenarios":"Thrown at internal/sources/serverlessspark/serverlessspark.go:244 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify pageSize/pageToken/filter values are valid and the token is current","Check IAM list permissions on the project/location","Retry on transient Google API errors"],"exampleFix":null,"handlingStrategy":"retry","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"}