Fix condition check for memories_result type in Memory class#3596
Merged
parshvadaftari merged 1 commit intomem0ai:mainfrom Oct 16, 2025
Merged
Conversation
parshvadaftari
approved these changes
Oct 16, 2025
Contributor
parshvadaftari
left a comment
There was a problem hiding this comment.
Looks good to me.
Contributor
|
Thank you for contributing to mem0 @aesher9o1 ! |
Contributor
Author
|
@parshvadaftari any chance we could do a minor release with my fix? We at Quillbot at trying to go live with mem0, currently blocked because of the bug. |
Contributor
|
Hey @aesher9o1 we'll be making a next release next week as we just made the public release for 1.0.0. Sorry for the blocker from our end, we'll try to make the next release as soon as possible. |
garciaba79
pushed a commit
to garciaba79/mem0
that referenced
this pull request
Feb 12, 2026
jamebobob
pushed a commit
to jamebobob/mem0-vigil-recall
that referenced
this pull request
Mar 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixed a critical bug in
_get_all_from_vector_storemethod that caused MongoDB vector store to fail when retrieving memories viaget_all()operation.Root Cause:
The original code incorrectly unwrapped both tuples AND lists by taking the first element
[0]. Different vector store backends return data in different formats:([OutputData, ...], metadata)[OutputData, ...]When MongoDB returned a list of memories, the code would extract only the first memory object instead of keeping the entire list. This caused the subsequent iteration loop to fail with
AttributeError: 'tuple' object has no attribute 'id'.The Fix:
Changed the type check from
isinstance(memories_result, (tuple, list))toisinstance(memories_result, tuple), ensuring only tuple-wrapped results are unwrapped while lists are preserved as-is.Impact:
get_all()operationsFixes # (issue)
Type of change
How Has This Been Tested?
Tested with MongoDB vector store backend:
Test Configuration:
memory_client.get_all(user_id=..., agent_id=..., run_id=...)Test Results:
AttributeError: 'tuple' object has no attribute 'id'at line 1496Test Script:
Checklist:
Maintainer Checklist