googleapis/mcp-toolbox · error

error generating logs url: %v

Error message

error generating logs url: %v

What it means

BatchLogsURLFromProto failed for a listed batch: its resource name did not match the expected projects/.../batches/... pattern, so the Cloud Logging URL cannot be constructed during ToBatches conversion.

Source

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

	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
}

func (s *Source) GetBatch(ctx context.Context, name string) (map[string]any, error) {
	client := s.GetBatchControllerClient()

View on GitHub (pinned to 8cc6e09de2)

Solutions

  1. Check the batch name format returned by the API
  2. Validate the location/project embedded in the name
  3. Skip or quarantine batches with malformed names
Defensive patterns

Strategy: validation

When it happens

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