{"record":{"id":"32b29952d1ac5a4a","repo":"googleapis/mcp-toolbox","slug":"failed-to-parse-batch-name-s","errorCode":null,"errorMessage":"failed to parse batch name: %s","messagePattern":"failed to parse batch name: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/sources/serverlessspark/url.go","lineNumber":38,"sourceCode":"\t\"regexp\"\n\t\"time\"\n\n\t\"cloud.google.com/go/dataproc/v2/apiv1/dataprocpb\"\n)\n\nvar batchFullNameRegex = regexp.MustCompile(`projects/(?P<project>[^/]+)/locations/(?P<location>[^/]+)/batches/(?P<batch_id>[^/]+)`)\nvar sessionTemplateFullNameRegex = regexp.MustCompile(`projects/(?P<project>[^/]+)/locations/(?P<location>[^/]+)/sessionTemplates/(?P<template_id>[^/]+)`)\n\nconst (\n\tlogTimeBufferBefore = 1 * time.Minute\n\tlogTimeBufferAfter  = 10 * time.Minute\n)\n\n// Extract BatchDetails extracts the project ID, location, and batch ID from a fully qualified batch name.\nfunc ExtractBatchDetails(batchName string) (projectID, location, batchID string, err error) {\n\tmatches := batchFullNameRegex.FindStringSubmatch(batchName)\n\tif len(matches) < 4 {\n\t\treturn \"\", \"\", \"\", fmt.Errorf(\"failed to parse batch name: %s\", batchName)\n\t}\n\treturn matches[1], matches[2], matches[3], nil\n}\n\n// BatchConsoleURL builds a URL to the Google Cloud Console linking to the batch summary page.\nfunc BatchConsoleURL(projectID, location, batchID string) string {\n\treturn fmt.Sprintf(\"https://console.cloud.google.com/dataproc/batches/%s/%s/summary?project=%s\", location, batchID, projectID)\n}\n\n// BatchLogsURL builds a URL to the Google Cloud Console showing Cloud Logging for the given batch and time range.\n//\n// The implementation adds some buffer before and after the provided times.\nfunc BatchLogsURL(projectID, location, batchID string, startTime, endTime time.Time) string {\n\tadvancedFilterTemplate := `resource.type=\"cloud_dataproc_batch\"\nresource.labels.project_id=\"%s\"\nresource.labels.location=\"%s\"\nresource.labels.batch_id=\"%s\"`\n\tadvancedFilter := fmt.Sprintf(advancedFilterTemplate, projectID, location, batchID)","sourceCodeStart":20,"sourceCodeEnd":56,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/sources/serverlessspark/url.go#L20-L56","documentation":"The batchFullNameRegex failed to match the given batch name: it does not follow projects/<project>/locations/<location>/batches/<batch_id>, so project, location and batch ID cannot be extracted.","triggerScenarios":"Thrown at internal/sources/serverlessspark/url.go:38 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass a fully qualified batch name of the form projects/P/locations/L/batches/B","Check for typos, URL encoding or extra path segments in the name","Verify the value came from the Dataproc API unmodified"],"exampleFix":null,"handlingStrategy":"validation","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"}