googleapis/mcp-toolbox · error
segment cannot be only whitespace
Error message
segment cannot be only whitespace
What it means
Segment guard in validateSegment: a path segment contains only whitespace characters, which Firestore would reject as a collection ID or document ID.
Source
Thrown at internal/tools/firestore/util/validator.go:113
return nil
}
// validateSegment validates a single path segment
func validateSegment(segment string, isCollection bool) error {
segmentType := "document ID"
if isCollection {
segmentType = "collection ID"
}
// Check for empty segment
if segment == "" {
return fmt.Errorf("segment cannot be empty")
}
// Check for whitespace-only segment
if strings.TrimSpace(segment) == "" {
return fmt.Errorf("segment cannot be only whitespace")
}
// Check for single or double period
if segment == "." || segment == ".." {
return fmt.Errorf("segment cannot be '.' or '..'")
}
// Check for reserved prefix
if strings.HasPrefix(segment, "__") {
return fmt.Errorf("%s cannot start with '__' (reserved prefix)", segmentType)
}
return nil
}
// IsAbsolutePath checks if a path is an absolute Firestore path
func IsAbsolutePath(path string) bool {
return absolutePathRegex.MatchString(path)View on GitHub (pinned to 8cc6e09de2)
Solutions
- Trim whitespace from segment names
- Ensure the path does not contain a segment of just spaces or tabs
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at internal/tools/firestore/util/validator.go:113 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/4c97e26d7f427748.
Report an issue: GitHub.