diff --git a/.changeset/crisp-kiwis-end.md b/.changeset/crisp-kiwis-end.md new file mode 100644 index 000000000000..71996409dade --- /dev/null +++ b/.changeset/crisp-kiwis-end.md @@ -0,0 +1,5 @@ +--- +"@langchain/community": patch +--- + +Fix possible race condition in FileSystemChatMessageHistory diff --git a/libs/langchain-community/src/stores/message/file_system.ts b/libs/langchain-community/src/stores/message/file_system.ts index 0e49b5ee95dd..8d9ceaab4944 100644 --- a/libs/langchain-community/src/stores/message/file_system.ts +++ b/libs/langchain-community/src/stores/message/file_system.ts @@ -113,7 +113,6 @@ export class FileSystemChatMessageHistory extends BaseListChatMessageHistory { protected async loadStore(): Promise { try { - await fs.access(this.filePath, fs.constants.F_OK); const store = await fs.readFile(this.filePath, "utf-8"); return JSON.parse(store) as FileChatStore; } catch (_error) {