fix(ts-sdk): prevent hallucinated memories on empty messages payload … (#5613)

This commit is contained in:
Md. Mamun Hossain
2026-06-18 17:01:02 +05:30
committed by GitHub
parent 466249113c
commit 4065e846f6
2 changed files with 11 additions and 7 deletions
+5
View File
@@ -253,6 +253,11 @@ export default class MemoryClient {
messages: Array<Message>,
options: AddMemoryOptions & Record<string, any> = {},
): Promise<Array<Memory>> {
// Tightly scoped validation guard to resolve #5465
if (!messages || (Array.isArray(messages) && messages.length === 0)) {
throw new Error("Cannot process an empty messages payload.");
}
if (this.telemetryId === "") await this.ping();
const payload = this._preparePayload(messages, options);