Repository navigation
[Bug]: Background semantic ingestion crashes/restarts when semantic storage references missing episode_ids #1102
Copy link
Copy link
Labels
priority: highIssue is urgent or highly impactful. Needs to be addressed as soon as possible.Issue is urgent or highly impactful. Needs to be addressed as soon as possible.
Description
Activity
Hi @o-love , i hit a lot of errors today after set prompt to
prompt: default_org_categories: [] default_project_categories: [] default_user_categories: - profile_prompterrors are
2026-02-24 23:53:49,628 [ERROR] memmachine.semantic_memory.semantic_ingestion - Failed to process set_id mem_user_set_org_MemVerge_1_7e8d0b20c039__producer_id_Mel Traceback (most recent call last): File "/app/.venv/lib/python3.12/site-packages/memmachine/semantic_memory/semantic_ingestion.py", line 61, in _run await self._process_single_set(set_id) File "/app/.venv/lib/python3.12/site-packages/memmachine/semantic_memory/semantic_ingestion.py", line 110, in _process_single_set raise ValueError( ValueError: Failed to retrieve messages. Invalid episode_ids exist for set_id mem_user_set_org_MemVerge_1_7e8d0b20c039__producer_id_Mel: ['2', '4'] 2026-02-24 23:53:49,629 [ERROR] memmachine.semantic_memory.semantic_ingestion - Failed to process set_id mem_user_set_org_MemVerge_1_7e8d0b20c039__producer_id_Sarah Traceback (most recent call last): File "/app/.venv/lib/python3.12/site-packages/memmachine/semantic_memory/semantic_ingestion.py", line 61, in _run await self._process_single_set(set_id) File "/app/.venv/lib/python3.12/site-packages/memmachine/semantic_memory/semantic_ingestion.py", line 110, in _process_single_set raise ValueError( ValueError: Failed to retrieve messages. Invalid episode_ids exist for set_id mem_user_set_org_MemVerge_1_7e8d0b20c039__producer_id_Sarah: ['10', '7', '9']- addedpriority: highIssue is urgent or highly impactful. Needs to be addressed as soon as possible.Issue is urgent or highly impactful. Needs to be addressed as soon as possible.
on Feb 25, 2026 Added priority label since the error can be reproduced after using user level profile prompt.
- added 5 commits that reference this issue
on Feb 27, 2026 - added a commit that references this issue
on Feb 28, 2026 Thank you @o-love for the fix, i don't see this error anymore in my test!
Metadata
Metadata
Labels
priority: highIssue is urgent or highly impactful. Needs to be addressed as soon as possible.Issue is urgent or highly impactful. Needs to be addressed as soon as possible.
Describe the bug
Reported error - https://github.com/MemMachine/MemMachine/actions/runs/21885425744/job/63179096417
The job is failing because the ingestion process encountered invalid episode_ids for set_id user-b, specifically ['4'], resulting in this error:
ValueError: Failed to retrieve messages. Invalid episode_ids exist for set_id user-b: ['4']
This error is raised in src/memmachine/semantic_memory/semantic_ingestion.py at line 110, when messages cannot be retrieved for the given episode_ids.
Steps to reproduce
Review any Pull Request that failed the test.
Expected behavior
Unit tests should pass.
Environment
Additional context
Proposed fix
Investigate why episode_id '4' is invalid or missing from the episode storage. Check if it's being deleted prematurely or not added correctly.
If an episode was deleted or failed to save, ensure all references to that episode_id are removed or handled gracefully.
You can modify the ingestion logic to skip invalid episode_ids rather than fail entirely.
In src/memmachine/semantic_memory/semantic_ingestion.py, update the _process_single_set method as follows:
Additionally, audit your data insertion and deletion routines to prevent inconsistent episode references for set_id user-b.
This change will prevent complete ingestion failure and allow processing of valid messages.