From d05f3a0621667f970b8a06fcab210ef3bab466af Mon Sep 17 00:00:00 2001 From: Ben Burns <803016+benjamincburns@users.noreply.github.com> Date: Fri, 18 Oct 2024 07:19:03 +1300 Subject: [PATCH] fix(checkpoint): don't throw in MemorySaver.list if thread not found (#584) --- 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 72f04807..e247133a 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