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