googleapis/mcp-toolbox · error
failed to parse session template name: %s
Error message
failed to parse session template name: %s
What it means
The sessionTemplateFullNameRegex failed to match the given session template name: it does not follow projects/<project>/locations/<location>/sessionTemplates/<template_id>, so its components cannot be extracted.
Source
Thrown at internal/sources/serverlessspark/url.go:98
return BatchConsoleURL(projectID, location, batchID), nil
}
// BatchLogsURLFromProto builds a URL to the Google Cloud Console showing Cloud Logging for the given batch and time range.
func BatchLogsURLFromProto(batchPb *dataprocpb.Batch) (string, error) {
projectID, location, batchID, err := ExtractBatchDetails(batchPb.GetName())
if err != nil {
return "", err
}
createTime := batchPb.GetCreateTime().AsTime()
stateTime := batchPb.GetStateTime().AsTime()
return BatchLogsURL(projectID, location, batchID, createTime, stateTime), nil
}
// ExtractSessionTemplateDetails extracts the project ID, location, and session template ID from a fully qualified sessionTemplateName.
func ExtractSessionTemplateDetails(sessionTemplateName string) (projectID, location, sessionTemplateID string, err error) {
matches := sessionTemplateFullNameRegex.FindStringSubmatch(sessionTemplateName)
if len(matches) < 4 {
return "", "", "", fmt.Errorf("failed to parse session template name: %s", sessionTemplateName)
}
return matches[1], matches[2], matches[3], nil
}
var sessionFullNameRegex = regexp.MustCompile(`projects/(?P<project>[^/]+)/locations/(?P<location>[^/]+)/sessions/(?P<session_id>[^/]+)`)
// ExtractSessionDetails extracts the project ID, location, and session ID from a fully qualified session name.
func ExtractSessionDetails(sessionName string) (projectID, location, sessionID string, err error) {
matches := sessionFullNameRegex.FindStringSubmatch(sessionName)
if len(matches) < 4 {
return "", "", "", fmt.Errorf("failed to parse session name: %s", sessionName)
}
return matches[1], matches[2], matches[3], nil
}
// SessionConsoleURL builds a URL to the Google Cloud Console linking to the session summary page.
func SessionConsoleURL(projectID, location, sessionID string) string {
return fmt.Sprintf("https://console.cloud.google.com/dataproc/interactive/%s/%s/details?project=%s", location, sessionID, projectID)View on GitHub (pinned to 8cc6e09de2)
Solutions
- Pass a fully qualified template name of the form projects/P/locations/L/sessionTemplates/T
- Check for typos or extra path segments
- Verify the value came from the Dataproc API unmodified
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at internal/sources/serverlessspark/url.go:98 when the library encounters an invalid state.
Common situations: See trigger scenarios.
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
AI-assisted analysis of googleapis/mcp-toolbox@8cc6e09de2 (2026-09-05).
Data as JSON: /api/errors/95198fbb87838548.
Report an issue: GitHub.