googleapis/mcp-toolbox · error

failed to get batch: %w

Error message

failed to get batch: %w

What it means

The Dataproc GetBatch RPC failed for the requested batch name — the batch likely does not exist under the configured project/location, or the call hit permissions/connectivity issues.

Source

Thrown at internal/sources/serverlessspark/serverlessspark.go:290

			CreateTime: batchPb.CreateTime.AsTime().Format(time.RFC3339),
			Operation:  batchPb.Operation,
			ConsoleURL: consoleUrl,
			LogsURL:    logsUrl,
		}
		batches = append(batches, batch)
	}
	return batches, nil
}

func (s *Source) GetBatch(ctx context.Context, name string) (map[string]any, error) {
	client := s.GetBatchControllerClient()
	req := &dataprocpb.GetBatchRequest{
		Name: fmt.Sprintf("projects/%s/locations/%s/batches/%s", s.GetProject(), s.GetLocation(), name),
	}

	batchPb, err := client.GetBatch(ctx, req)
	if err != nil {
		return nil, fmt.Errorf("failed to get batch: %w", err)
	}

	jsonBytes, err := protojson.Marshal(batchPb)
	if err != nil {
		return nil, fmt.Errorf("failed to marshal batch to JSON: %w", err)
	}

	var result map[string]any
	if err := json.Unmarshal(jsonBytes, &result); err != nil {
		return nil, fmt.Errorf("failed to unmarshal batch JSON: %w", err)
	}

	consoleUrl, err := BatchConsoleURLFromProto(batchPb)
	if err != nil {
		return nil, fmt.Errorf("error generating console url: %v", err)
	}
	logsUrl, err := BatchLogsURLFromProto(batchPb)
	if err != nil {

View on GitHub (pinned to 8cc6e09de2)

Solutions

  1. Confirm the batch ID exists in the configured project and location
  2. Check IAM read permissions and network access
  3. Retry on transient API failures
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at internal/sources/serverlessspark/serverlessspark.go:290 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/4fae2f8027b22a65. Report an issue: GitHub.