Skip to content

Pipeline halts on missing document vector ID #828

@relder251

Description

@relder251

Description

When running the Agent-Zero persistent patch automation pipeline, the system sometimes halts with an exception if an internal document or vector database entry referenced during task execution is missing. This causes the scheduled task to enter an error state that blocks all further processing until a manual reset/correction is performed. The problem appears related to memory or vectorstore access rather than repository content.

Expected Results

Upon referencing a missing document ID or vector entry, the pipeline should surface a user-facing message, skip the problematic repo or step, and continue normally with the remaining tasks in the queue. No manual intervention should be required for normal recovery.

Actual Results

The scheduled task transitions to 'error' state and emits the following error:

ValueError: Could not find document for id Lvvd2OPsDT, got ID Lvvd2OPsDT not found.
Traceback (most recent call last):
  File "/[a0](http://127.0.0.1:5000/#)/[agent.py](http://127.0.0.1:5000/#)", line 380, in monologue
    prompt = await self.prepare_prompt(loop_data=self.loop_data)
  (stack continues)
  File "/[opt](http://127.0.0.1:5000/#)/[venv-a0](http://127.0.0.1:5000/#)/[lib](http://127.0.0.1:5000/#)/[python3.12](http://127.0.0.1:5000/#)/[site-packages](http://127.0.0.1:5000/#)/[langchain_community](http://127.0.0.1:5000/#)/[vectorstores](http://127.0.0.1:5000/#)/[faiss.py](http://127.0.0.1:5000/#)", line 430, in similarity_search_with_score_by_vector
    raise ValueError(f"Could not find document for id {_id}, got {doc}")
ValueError: Could not find document for id Lvvd2OPsDT, got ID Lvvd2OPsDT not found.

Could not find document for id Lvvd2OPsDT, got ID Lvvd2OPsDT not found.
Traceback (most recent call last):
Traceback (most recent call last):
File "/a0/agent.py", line 380, in monologue
prompt = await self.prepare_prompt(loop_data=self.loop_data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/a0/agent.py", line 495, in prepare_prompt
await self.call_extensions("message_loop_prompts_after", loop_data=loop_data)
File "/a0/agent.py", line 922, in call_extensions
return await call_extensions(extension_point=extension_point, agent=self, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/a0/python/helpers/extension.py", line 39, in call_extensions
await cls(agent=agent).execute(**kwargs)
File "/a0/python/extensions/message_loop_prompts_after/_91_recall_wait.py", line 26, in execute
await task
File "/opt/pyenv/versions/3.12.4/lib/python3.12/asyncio/futures.py", line 287, in await
yield self # This tells Task to wait for completion.
^^^^^^^^^^
File "/opt/pyenv/versions/3.12.4/lib/python3.12/asyncio/tasks.py", line 385, in __wakeup
future.result()
File "/opt/pyenv/versions/3.12.4/lib/python3.12/asyncio/futures.py", line 203, in result
raise self._exception.with_traceback(self._exception_tb)
File "/opt/pyenv/versions/3.12.4/lib/python3.12/asyncio/tasks.py", line 316, in __step_run_and_handle_result
result = coro.throw(exc)
^^^^^^^^^^^^^^^
File "/a0/python/extensions/message_loop_prompts_after/_50_recall_memories.py", line 118, in search_memories
memories = await db.search_similarity_threshold(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/a0/python/helpers/memory.py", line 346, in search_similarity_threshold
return await self.db.asearch(
^^^^^^^^^^^^^^^^^^^^^^
File "/opt/venv-a0/lib/python3.12/site-packages/langchain_core/vectorstores/base.py", line 380, in asearch
docs_and_similarities = await self.asimilarity_search_with_relevance_scores(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/venv-a0/lib/python3.12/site-packages/langchain_core/vectorstores/base.py", line 603, in asimilarity_search_with_relevance_scores
docs_and_similarities = await self._asimilarity_search_with_relevance_scores(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

13 stack lines skipped <<<

File "/opt/pyenv/versions/3.12.4/lib/python3.12/asyncio/futures.py", line 287, in await
yield self # This tells Task to wait for completion.
^^^^^^^^^^
File "/opt/pyenv/versions/3.12.4/lib/python3.12/asyncio/tasks.py", line 385, in __wakeup
future.result()
File "/opt/pyenv/versions/3.12.4/lib/python3.12/asyncio/futures.py", line 203, in result
raise self._exception.with_traceback(self._exception_tb)
File "/opt/pyenv/versions/3.12.4/lib/python3.12/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/venv-a0/lib/python3.12/site-packages/langchain_core/runnables/config.py", line 613, in wrapper
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/opt/venv-a0/lib/python3.12/site-packages/langchain_community/vectorstores/faiss.py", line 430, in similarity_search_with_score_by_vector
raise ValueError(f"Could not find document for id {_id}, got {doc}")
ValueError: Could not find document for id Lvvd2OPsDT, got ID Lvvd2OPsDT not found.

ValueError: Could not find document for id Lvvd2OPsDT, got ID Lvvd2OPsDT not found.

Steps to Reproduce

  1. Start a persistent scheduled patch automation task that processes a queue of repositories (e.g., in the "open_source_repository_security_auditing" project).
  2. Allow the automation to proceed until a PATCH_NOTES.md or related artifact generated for a repo is referenced or queried by the agent's recall/vectorstore subsystem.
  3. Manually remove or corrupt an internal document or vector entry indexed under a specific ID (e.g., delete or rename a PATCH_NOTES.md file or patch artifact from the file system, or disrupt the internal vectorstore index files used by the memory system).
  4. Wait for the pipeline to recall/query this document. The task will halt, producing the above ValueError and entering error state.
  5. The queue blocks on this error until manual intervention (reset or repair) is performed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions