googleapis/mcp-toolbox · error
segment cannot be '.' or '..'
Error message
segment cannot be '.' or '..'
What it means
Segment guard in validateSegment: a path segment is '.' or '..', an attempt at relative traversal that Firestore paths do not support.
Source
Thrown at internal/tools/firestore/util/validator.go:118
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)
}
// IsRelativePath checks if a path is a relative Firestore path
func IsRelativePath(path string) bool {
return path != "" && !IsAbsolutePath(path)View on GitHub (pinned to 8cc6e09de2)
Solutions
- Write out the literal path without dot segments
- Use the exact collection IDs and document IDs in the path
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at internal/tools/firestore/util/validator.go:118 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/99ed40e47e12dda4.
Report an issue: GitHub.