googleapis/mcp-toolbox · error
failed to list batches: %w
Error message
failed to list batches: %w
What it means
The paginated Dataproc ListBatches RPC (pager.NextPage) failed while fetching batches — invalid page token/filter, permissions, or a transient API error.
Source
Thrown at internal/sources/serverlessspark/serverlessspark.go:244
}
if ps != nil {
req.PageSize = int32(*ps)
}
if pt != "" {
req.PageToken = pt
}
if filter != "" {
req.Filter = filter
}
it := client.ListBatches(ctx, req)
pager := iterator.NewPager(it, int(req.PageSize), req.PageToken)
var batchPbs []*dataprocpb.Batch
nextPageToken, err := pager.NextPage(&batchPbs)
if err != nil {
return nil, fmt.Errorf("failed to list batches: %w", err)
}
batches, err := ToBatches(batchPbs)
if err != nil {
return nil, err
}
return ListBatchesResponse{Batches: batches, NextPageToken: nextPageToken}, nil
}
// ToBatches converts a slice of protobuf Batch messages to a slice of Batch structs.
func ToBatches(batchPbs []*dataprocpb.Batch) ([]Batch, error) {
batches := make([]Batch, 0, len(batchPbs))
for _, batchPb := range batchPbs {
consoleUrl, err := BatchConsoleURLFromProto(batchPb)
if err != nil {
return nil, fmt.Errorf("error generating console url: %v", err)
}View on GitHub (pinned to 8cc6e09de2)
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
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at internal/sources/serverlessspark/serverlessspark.go:244 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of googleapis/mcp-toolbox@8cc6e09de2 (2026-09-05).
Data as JSON: /api/errors/95b47b01c22b05bd.
Report an issue: GitHub.