{"record":{"id":"2ae066b129613da9","repo":"googleapis/mcp-toolbox","slug":"path-must-be-relative-e-g-s-not-absolute","errorCode":null,"errorMessage":"path must be relative (e.g., '%s'), not absolute (matching pattern: ^projects/[^/]+/databases/[^/]+/documents/)","messagePattern":"path must be relative \\(e\\.g\\., '(.+?)'\\), not absolute \\(matching pattern: \\^projects/\\[\\^/\\]\\+/databases/\\[\\^/\\]\\+/documents/\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/tools/firestore/util/validator.go","lineNumber":67,"sourceCode":"// validatePath is the common validation function for both collection and document paths\nfunc validatePath(path string, pathType PathType) error {\n\tpathTypeName := \"document\"\n\tif pathType == CollectionPath {\n\t\tpathTypeName = \"collection\"\n\t}\n\n\t// Check for empty path\n\tif path == \"\" {\n\t\treturn fmt.Errorf(\"%s path cannot be empty\", pathTypeName)\n\t}\n\n\t// Check if it's an absolute path\n\tif absolutePathRegex.MatchString(path) {\n\t\texample := \"users/userId\"\n\t\tif pathType == CollectionPath {\n\t\t\texample = \"users\"\n\t\t}\n\t\treturn fmt.Errorf(\"path must be relative (e.g., '%s'), not absolute (matching pattern: ^projects/[^/]+/databases/[^/]+/documents/)\", example)\n\t}\n\n\t// Split the path using strings.Split to preserve empty segments\n\tsegments := strings.Split(path, \"/\")\n\n\t// Check for empty result\n\tif len(segments) == 0 {\n\t\treturn fmt.Errorf(\"%s path cannot be empty or contain only slashes\", pathTypeName)\n\t}\n\n\t// Check segment count based on path type\n\tsegmentCount := len(segments)\n\tif pathType == CollectionPath && segmentCount%2 == 0 {\n\t\t// Collection paths must have an odd number of segments\n\t\treturn fmt.Errorf(\"invalid collection path: must have an odd number of segments (e.g., 'collection' or 'collection/doc/subcollection'), got %d segments\", segmentCount)\n\t} else if pathType == DocumentPath && segmentCount%2 != 0 {\n\t\t// Document paths must have an even number of segments\n\t\treturn fmt.Errorf(\"invalid document path: must have an even number of segments (e.g., 'collection/doc'), got %d segments\", segmentCount)","sourceCodeStart":49,"sourceCodeEnd":85,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/tools/firestore/util/validator.go#L49-L85","documentation":"Guard in the shared Firestore path validator: the path matches the absolute-resource pattern (^projects/.../databases/.../documents/...); the API expects document-relative paths only.","triggerScenarios":"Thrown at internal/tools/firestore/util/validator.go:67 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Strip the projects/<p>/databases/<d>/documents/ prefix and send just the tail, e.g. 'users/alice'","Use the relative form shown in the error example"],"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"}