{"record":{"id":"3b3a4aa1adb017ed","repo":"googleapis/mcp-toolbox","slug":"unable-to-create-mongodb-client-w","errorCode":null,"errorMessage":"unable to create MongoDB client: %w","messagePattern":"unable to create MongoDB client: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/sources/mongodb/mongodb.go","lineNumber":64,"sourceCode":"\t\treturn nil, err\n\t}\n\treturn actual, nil\n}\n\ntype Config struct {\n\tName string `yaml:\"name\" validate:\"required\"`\n\tType string `yaml:\"type\" validate:\"required\"`\n\tUri  string `yaml:\"uri\" validate:\"required\"` // MongoDB Atlas connection URI\n}\n\nfunc (r Config) SourceConfigType() string {\n\treturn SourceType\n}\n\nfunc (r Config) Initialize(ctx context.Context, tracer trace.Tracer) (sources.Source, error) {\n\tclient, err := initMongoDBClient(ctx, tracer, r.Name, r.Uri)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to create MongoDB client: %w\", err)\n\t}\n\n\t// Verify the connection\n\terr = client.Ping(ctx, nil)\n\tif err != nil {\n\t\t_ = client.Disconnect(ctx)\n\t\treturn nil, fmt.Errorf(\"unable to connect successfully: %w\", err)\n\t}\n\n\ts := &Source{\n\t\tConfig: r,\n\t\tClient: client,\n\t}\n\treturn s, nil\n}\n\nvar _ sources.Source = &Source{}\n","sourceCodeStart":46,"sourceCodeEnd":82,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/sources/mongodb/mongodb.go#L46-L82","documentation":"Error \"unable to create MongoDB client: %w\" thrown in googleapis/mcp-toolbox.","triggerScenarios":"Thrown at internal/sources/mongodb/mongodb.go:64 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"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"}