From 997f23041c1019a5db02843085d1f8c3335cf1ba Mon Sep 17 00:00:00 2001 From: Ben Burns <803016+benjamincburns@users.noreply.github.com> Date: Sat, 12 Oct 2024 11:16:27 +1300 Subject: [PATCH] fix(checkpoint): don't throw in MemorySaver.list if thread not found --- libs/checkpoint/src/memory.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libs/checkpoint/src/memory.ts b/libs/checkpoint/src/memory.ts index ad8e45d9..716a7830 100644 --- a/libs/checkpoint/src/memory.ts +++ b/libs/checkpoint/src/memory.ts @@ -178,7 +178,9 @@ export class MemorySaver extends BaseCheckpointSaver { const configCheckpointNamespace = config.configurable?.checkpoint_ns; for (const threadId of threadIds) { - for (const checkpointNamespace of Object.keys(this.storage[threadId])) { + for (const checkpointNamespace of Object.keys( + this.storage[threadId] ?? {} + )) { if ( configCheckpointNamespace !== undefined && checkpointNamespace !== configCheckpointNamespace