n8n-io/n8n · error · NodeOperationError
MongoDB connection error
Error message
MongoDB connection error: ${error.message} What it means
Catch-all around MongoDB chat-memory setup: connecting the client or building the memory threw (bad host/port/credentials/TLS, unreachable server). The client is closed and the underlying driver message is chained to this NodeOperationError.
Solutions
- Read the chained driver message to identify the connection failure
- Verify host, port, user/password and TLS settings in the MongoDB credential
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at packages/@n8n/nodes-langchain/nodes/memory/MemoryMongoDbChat/MemoryMongoDbChat.node.ts:168 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of n8n-io/n8n@5ac6606e81 (2026-08-12).
Data as JSON: /api/errors/836dba9135c3de66.
Report an issue: GitHub.
Appendix: source
Thrown at packages/@n8n/nodes-langchain/nodes/memory/MemoryMongoDbChat/MemoryMongoDbChat.node.ts:168
memoryKey: 'chat_history',
chatHistory: mongoDBChatHistory,
returnMessages: true,
inputKey: 'input',
outputKey: 'output',
k: this.getNodeParameter('contextWindowLength', itemIndex, 5) as number,
});
async function closeFunction() {
await client.close();
}
return {
closeFunction,
response: logWrapper(memory, this),
};
} catch (error) {
void client.close();
throw new NodeOperationError(this.getNode(), `MongoDB connection error: ${error.message}`);
}
}
}
View on GitHub (pinned to 5ac6606e81)