googleapis/mcp-toolbox · error

error generating console url: %v

Error message

error generating console url: %v

What it means

BatchConsoleURLFromProto failed while converting each protobuf Batch into a Batch struct: the batch's resource name could not be parsed (via ExtractBatchDetails) so the Cloud Console URL cannot be built.

Source

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

	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)
		}
		logsUrl, err := BatchLogsURLFromProto(batchPb)
		if err != nil {
			return nil, fmt.Errorf("error generating logs url: %v", err)
		}
		batch := Batch{
			Name:       batchPb.Name,
			UUID:       batchPb.Uuid,
			State:      batchPb.State.Enum().String(),
			Creator:    batchPb.Creator,
			CreateTime: batchPb.CreateTime.AsTime().Format(time.RFC3339),
			Operation:  batchPb.Operation,
			ConsoleURL: consoleUrl,
			LogsURL:    logsUrl,
		}
		batches = append(batches, batch)
	}
	return batches, nil

View on GitHub (pinned to 8cc6e09de2)

Solutions

  1. Inspect the offending batch's name field for unexpected formatting
  2. Verify Dataproc returns fully qualified batch names
  3. Handle or skip malformed batches when listing
Defensive patterns

Strategy: validation

When it happens

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