{"record":{"id":"aec27c9e00faf771","repo":"n8n-io/n8n","slug":"database-name-must-be-provided-either-in-credentia","errorCode":null,"errorMessage":"Database name must be provided either in credentials or in node parameters","messagePattern":"Database name must be provided either in credentials or in node parameters","errorType":"exception","errorClass":"NodeOperationError","httpStatus":null,"severity":"error","filePath":"packages/@n8n/nodes-langchain/nodes/memory/MemoryMongoDbChat/MemoryMongoDbChat.node.ts","lineNumber":126,"sourceCode":"\t\t} else {\n\t\t\t// Build connection string from individual fields\n\t\t\tconst host = credentials.host;\n\t\t\tconst port = credentials.port;\n\t\t\tconst user = credentials.user ? encodeURIComponent(credentials.user) : '';\n\t\t\tconst password = credentials.password ? encodeURIComponent(credentials.password) : '';\n\t\t\tconst authString = user && password ? `${user}:${password}@` : '';\n\t\t\tconst tls = credentials.tls;\n\n\t\t\tconnectionString = `mongodb://${authString}${host}:${port}/?appname=n8n`;\n\t\t\tif (tls) {\n\t\t\t\tconnectionString += '&ssl=true';\n\t\t\t}\n\n\t\t\tdbName = databaseName || credentials.database;\n\t\t}\n\n\t\tif (!dbName) {\n\t\t\tthrow new NodeOperationError(\n\t\t\t\tthis.getNode(),\n\t\t\t\t'Database name must be provided either in credentials or in node parameters',\n\t\t\t);\n\t\t}\n\n\t\tconst client = new MongoClient(connectionString, {\n\t\t\tminPoolSize: 0,\n\t\t\tmaxPoolSize: 1,\n\t\t\tmaxIdleTimeMS: 30000,\n\t\t});\n\n\t\ttry {\n\t\t\tawait client.connect();\n\n\t\t\tconst db = client.db(dbName);\n\t\t\tconst collection = db.collection(collectionName);\n\n\t\t\tconst mongoDBChatHistory = new MongoDBChatMessageHistory({","sourceCodeStart":108,"sourceCodeEnd":144,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/nodes-langchain/nodes/memory/MemoryMongoDbChat/MemoryMongoDbChat.node.ts#L108-L144","documentation":"Error \"Database name must be provided either in credentials or in node parameters\" thrown in n8n-io/n8n.","triggerScenarios":"Thrown at packages/@n8n/nodes-langchain/nodes/memory/MemoryMongoDbChat/MemoryMongoDbChat.node.ts:126 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":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}