googleapis/mcp-toolbox · error

%s path cannot be empty

Error message

%s path cannot be empty

What it means

First guard in the shared Firestore path validator: the collection or document path string is empty, so there is no path to validate.

Source

Thrown at internal/tools/firestore/util/validator.go:58

	return validatePath(path, CollectionPath)
}

// ValidateDocumentPath validates that a path is a valid Firestore document path.
// Document paths must have an even number of segments (collection/doc or collection/doc/collection/doc)
func ValidateDocumentPath(path string) error {
	return validatePath(path, DocumentPath)
}

// validatePath is the common validation function for both collection and document paths
func validatePath(path string, pathType PathType) error {
	pathTypeName := "document"
	if pathType == CollectionPath {
		pathTypeName = "collection"
	}

	// Check for empty path
	if path == "" {
		return fmt.Errorf("%s path cannot be empty", pathTypeName)
	}

	// Check if it's an absolute path
	if absolutePathRegex.MatchString(path) {
		example := "users/userId"
		if pathType == CollectionPath {
			example = "users"
		}
		return fmt.Errorf("path must be relative (e.g., '%s'), not absolute (matching pattern: ^projects/[^/]+/databases/[^/]+/documents/)", example)
	}

	// Split the path using strings.Split to preserve empty segments
	segments := strings.Split(path, "/")

	// Check for empty result
	if len(segments) == 0 {
		return fmt.Errorf("%s path cannot be empty or contain only slashes", pathTypeName)
	}

View on GitHub (pinned to 8cc6e09de2)

Solutions

  1. Supply a non-empty relative path such as 'users' (collection) or 'users/alice' (document)
  2. Omit the parameter only if the tool marks it optional
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at internal/tools/firestore/util/validator.go:58 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/062416ab3df1c389. Report an issue: GitHub.