{"record":{"id":"4c97e26d7f427748","repo":"googleapis/mcp-toolbox","slug":"segment-cannot-be-only-whitespace","errorCode":null,"errorMessage":"segment cannot be only whitespace","messagePattern":"segment cannot be only whitespace","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/tools/firestore/util/validator.go","lineNumber":113,"sourceCode":"\n\treturn nil\n}\n\n// validateSegment validates a single path segment\nfunc validateSegment(segment string, isCollection bool) error {\n\tsegmentType := \"document ID\"\n\tif isCollection {\n\t\tsegmentType = \"collection ID\"\n\t}\n\n\t// Check for empty segment\n\tif segment == \"\" {\n\t\treturn fmt.Errorf(\"segment cannot be empty\")\n\t}\n\n\t// Check for whitespace-only segment\n\tif strings.TrimSpace(segment) == \"\" {\n\t\treturn fmt.Errorf(\"segment cannot be only whitespace\")\n\t}\n\n\t// Check for single or double period\n\tif segment == \".\" || segment == \"..\" {\n\t\treturn fmt.Errorf(\"segment cannot be '.' or '..'\")\n\t}\n\n\t// Check for reserved prefix\n\tif strings.HasPrefix(segment, \"__\") {\n\t\treturn fmt.Errorf(\"%s cannot start with '__' (reserved prefix)\", segmentType)\n\t}\n\n\treturn nil\n}\n\n// IsAbsolutePath checks if a path is an absolute Firestore path\nfunc IsAbsolutePath(path string) bool {\n\treturn absolutePathRegex.MatchString(path)","sourceCodeStart":95,"sourceCodeEnd":131,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/tools/firestore/util/validator.go#L95-L131","documentation":"Segment guard in validateSegment: a path segment contains only whitespace characters, which Firestore would reject as a collection ID or document ID.","triggerScenarios":"Thrown at internal/tools/firestore/util/validator.go:113 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Trim whitespace from segment names","Ensure the path does not contain a segment of just spaces or tabs"],"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"}