{"record":{"id":"4c313f2d7ef73181","repo":"googleapis/mcp-toolbox","slug":"no-document-found","errorCode":null,"errorMessage":"no document found","messagePattern":"no document found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/sources/mongodb/mongodb.go","lineNumber":280,"sourceCode":"\t\treturn nil, fmt.Errorf(\"error updating collection: %w\", err)\n\t}\n\treturn res.ModifiedCount, nil\n}\n\nfunc (s *Source) DeleteMany(ctx context.Context, filterString, database, collection string) (any, error) {\n\tvar filter = bson.D{}\n\terr := bson.UnmarshalExtJSON([]byte(filterString), false, &filter)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tres, err := s.MongoClient().Database(database).Collection(collection).DeleteMany(ctx, filter, options.DeleteMany())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif res.DeletedCount == 0 {\n\t\treturn nil, errors.New(\"no document found\")\n\t}\n\treturn res.DeletedCount, nil\n}\n\nfunc (s *Source) DeleteOne(ctx context.Context, filterString, database, collection string) (any, error) {\n\tvar filter = bson.D{}\n\terr := bson.UnmarshalExtJSON([]byte(filterString), false, &filter)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tres, err := s.MongoClient().Database(database).Collection(collection).DeleteOne(ctx, filter, options.DeleteOne())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn res.DeletedCount, nil\n}\n","sourceCodeStart":262,"sourceCodeEnd":298,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/sources/mongodb/mongodb.go#L262-L298","documentation":"validatePath (internal to validator.go, used by ValidateCollectionPath and ValidateDocumentPath) rejects an empty path string before any other check. pathTypeName is \"collection\" or \"document\" depending on the requested path type, so the message reads e.g. \"collection path cannot be empty\".","triggerScenarios":"Calling ValidateCollectionPath(\"\") or ValidateDocumentPath(\"\"); a tool parameter bound to an empty query/POST field; an env var or config key for a collection/document ID left unset.","commonSituations":"Missing query parameter in an HTTP request; user left the collection/document ID blank; config file with an empty value for the path field.","solutions":["Supply a non-empty collection or document path such as \"users\" or \"users/userId\".","Check the caller/config that produced the empty string and require the parameter before invoking the validator.","For document paths, use the odd number of segments form (e.g. \"users/userId\")."],"exampleFix":"// before\nerr := ValidateCollectionPath(\"\")\n// after\nif collection == \"\" { return errors.New(\"collection is required\") }\nerr := ValidateCollectionPath(collection)","handlingStrategy":"validation","validationCode":"func requireNonEmptyPath(p string, kind string) error { if strings.TrimSpace(p) == \"\" { return fmt.Errorf(\"%s path is required\", kind) }; return nil }","typeGuard":null,"tryCatchPattern":"if err := ValidateCollectionPath(path); err != nil {\n    if strings.Contains(err.Error(), \"path cannot be empty\") { /* prompt user / read missing config and retry */ }\n}","preventionTips":["Require path parameters at the request/config boundary before calling validators","Trim and check user-supplied collection/document IDs","Provide default or example paths in tool descriptions"],"tags":["firestore","path","validation"],"backgroundTag":"empty-path-parameter","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"}