666ghj/MiroFish · error · RuntimeError
Zep图谱写入未完整完成: {error}
Error message
Zep图谱写入未完整完成: {error} What it means
RuntimeError raised in the synchronous stop path (no monitor thread) when stopping the Zep graph-memory updater (ZepGraphMemoryManager.stop_updater) throws — e.g. the worker failed batches or timed out. The run is marked FAILED with this composed error, state is persisted, and the original exception is chained with 'from error'.
Source
Thrown at backend/app/services/simulation_runner.py:1062
with cls._finalization_lock(simulation_id):
state = cls.get_run_state(simulation_id) or state
if cls._graph_memory_enabled.get(simulation_id, False):
try:
ZepGraphMemoryManager.stop_updater(simulation_id)
cls._graph_memory_enabled.pop(simulation_id, None)
except Exception as error:
state.runner_status = RunnerStatus.FAILED
state.twitter_running = False
state.reddit_running = False
state.completed_at = datetime.now().isoformat()
state.error = f"Zep图谱写入未完整完成: {error}"
cls._save_run_state(state)
cls._sync_simulation_status(
simulation_id,
RunnerStatus.FAILED,
state.error,
)
raise RuntimeError(state.error) from error
state.runner_status = RunnerStatus.STOPPED
state.twitter_running = False
state.reddit_running = False
state.completed_at = datetime.now().isoformat()
state.error = None
cls._save_run_state(state)
cls._sync_simulation_status(
simulation_id,
RunnerStatus.STOPPED,
)
cls._manual_stop_requests.discard(simulation_id)
state = cls.get_run_state(simulation_id) or state
if state.runner_status == RunnerStatus.FAILED:
raise RuntimeError(state.error or "模拟停止失败")
if state.runner_status != RunnerStatus.STOPPED:
raise RuntimeError(
f"模拟停止未达到终态: {simulation_id}, status={state.runner_status}"View on GitHub (pinned to b5b53acc57)
Solutions
- Inspect the embedded cause after the colon — it is the underlying Zep failure (timeout vs failed batches) and dictates the fix.
- Verify ZEP_API_KEY validity and Zep API reachability, then retry: the graph may be partially ingested, so re-run or re-ingest the missing activity batches.
- If this recurs, increase ZEP_INGESTION_WAIT_TIMEOUT_SECONDS and check for network proxies/rate limits between backend and Zep Cloud.
Example fix
// before
SimulationRunner.stop_simulation(sim_id); # RuntimeError: Zep图谱写入未完整完成: 3 Zep activity batch(es) failed ...
// after
try:
SimulationRunner.stop_simulation(sim_id)
except RuntimeError as e:
if not str(e).startswith("Zep图谱写入未完整完成"):
raise
logger.warning(f"graph ingestion incomplete for {sim_id}: {e}; scheduling re-ingest")
schedule_reingest(sim_id); # replay actions.jsonl batches into Zep Defensive patterns
Strategy: try-catch
Try / catch
try:
SimulationRunner.stop_simulation(sim_id)
except RuntimeError as e:
if not str(e).startswith("Zep图谱写入未完整完成"):
raise
log_graph_incomplete(sim_id, str(e)) # quarantine + re-ingest workflow
state = SimulationRunner.get_run_state(sim_id) # FAILED; record artifacts Prevention
- Verify Zep API health and ZEP_API_KEY before stopping graph-memory runs.
- Monitor failed-batch counters during the run, not only at stop.
- Keep actions.jsonl until graph ingestion is confirmed complete so replay is possible.
When it happens
Trigger: stop_simulation on a graph-memory-enabled run without a monitor thread; ZepGraphMemoryManager.stop_updater raises TimeoutError ('worker did not stop') or RuntimeError ('N batch(es) failed'); the error string of that exception is embedded into 'Zep图谱写入未完整完成: ...'.
Common situations: Zep API outage or auth failure during the final flush at stop time; restart-recovery path or tests that stop a simulation synchronously while ingestion is still pending.
Related errors
- 模拟仍在停止中,图谱写入未在 {wait_timeout:.0f}s 内完成
- 启用图谱记忆更新时必须提供 graph_id
- Zep图谱更新器初始化失败: {e}
- {len(self._failed_batches)} Zep activity batch(es) failed; s
- 没有找到符合条件的实体,请检查图谱是否正确构建
AI-assisted analysis of 666ghj/MiroFish@b5b53acc57 (2026-08-14).
Data as JSON: /api/errors/94ee63b336e1354e.
Report an issue: GitHub.