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