666ghj/MiroFish · error · RuntimeError
Zep图谱更新器初始化失败: {e}
Error message
Zep图谱更新器初始化失败: {e} What it means
Raised in SimulationRunner's start path: ZepGraphMemoryManager.create_updater(simulation_id, graph_id) threw, the exception is logged, the run state is persisted as FAILED with error 'Zep图谱更新器初始化失败: <cause>', the simulation status is synced, and a RuntimeError chaining the original exception is raised. The wrapped cause is the real diagnosis — typically a Zep client/auth failure or an invalid/unreachable graph_id.
Source
Thrown at backend/app/services/simulation_runner.py:461
raise ValueError("启用图谱记忆更新时必须提供 graph_id")
try:
ZepGraphMemoryManager.create_updater(simulation_id, graph_id)
cls._graph_memory_enabled[simulation_id] = True
logger.info(f"已启用图谱记忆更新: simulation_id={simulation_id}, graph_id={graph_id}")
except Exception as e:
logger.error(f"创建图谱记忆更新器失败: {e}")
cls._graph_memory_enabled[simulation_id] = False
state.runner_status = RunnerStatus.FAILED
state.error = f"Zep图谱更新器初始化失败: {e}"
with cls._finalization_lock(simulation_id):
cls._save_run_state(state)
cls._sync_simulation_status(
simulation_id,
RunnerStatus.FAILED,
state.error,
)
raise RuntimeError(state.error) from e
else:
cls._graph_memory_enabled[simulation_id] = False
# 确定运行哪个脚本(脚本位于 backend/scripts/ 目录)
if platform == "twitter":
script_name = "run_twitter_simulation.py"
state.twitter_running = True
elif platform == "reddit":
script_name = "run_reddit_simulation.py"
state.reddit_running = True
else:
script_name = "run_parallel_simulation.py"
state.twitter_running = True
state.reddit_running = True
script_path = os.path.join(cls.SCRIPTS_DIR, script_name)
if not os.path.exists(script_path):View on GitHub (pinned to b5b53acc57)
Solutions
- Read the chained exception (raise ... from e) — the log line '创建图谱记忆更新器失败' plus the cause names the actual failure; fix that first.
- Verify ZEP_API_KEY is set and valid, and that graph_id exists in Zep for the project.
- Test connectivity to Zep from the backend container (curl the Zep API endpoint) if network policy may block egress.
- If Zep access cannot be restored now, restart with enable_graph_memory_update=false to unblock the run.
Example fix
# before runner.start_simulation(sim_id, enable_graph_memory_update=True, graph_id=graph_id) # after # verify updater prerequisites before starting assert Config.ZEP_API_KEY, 'ZEP_API_KEY required for graph memory' zep_client = Zep(api_key=Config.ZEP_API_KEY) zep_client.graph.get(graph_id=graph_id) # fails fast with the real error runner.start_simulation(sim_id, enable_graph_memory_update=True, graph_id=graph_id)
Defensive patterns
Strategy: try-catch
Validate before calling
assert Config.ZEP_API_KEY, 'ZEP_API_KEY required for graph memory updates' zep_client = Zep(api_key=Config.ZEP_API_KEY) zep_client.graph.get(graph_id=graph_id) # fail fast with the real Zep error before starting
Try / catch
try:
SimulationRunner.start_simulation(sim_id, enable_graph_memory_update=True, graph_id=graph_id)
except RuntimeError as e:
if 'Zep图谱更新器初始化失败' in str(e) and e.__cause__:
diagnose(e.__cause__) # the chained cause holds the real failure (auth/network/graph)
raise Prevention
- Always inspect the chained cause (__cause__) — the wrapper message alone is not diagnostic.
- Pre-validate ZEP_API_KEY and graph existence before enabling graph memory on a run.
- Fall back to enable_graph_memory_update=false when Zep is temporarily unavailable, and retry the run later with it on.
When it happens
Trigger: ZEP_API_KEY missing/invalid so the updater's Zep client cannot be constructed; graph_id referring to a nonexistent graph; Zep Cloud unreachable (network/proxy/DNS); ZepGraphMemoryManager.create_updater hitting its own validation on arguments. Any exception inside create_updater funnels here.
Common situations: ZEP_API_KEY not set in the environment while LLM keys are (updater initialization is the first Zep touch at start time); expired or rotated Zep API key; wrong graph_id copied from another project; egress-blocked container reaching api.getzep.com.
Related errors
- 启用图谱记忆更新时必须提供 graph_id
- 模拟仍在停止中,图谱写入未在 {wait_timeout:.0f}s 内完成
- Zep图谱写入未完整完成: {error}
- 没有找到符合条件的实体,请检查图谱是否正确构建
- ZEP_API_KEY 未配置
AI-assisted analysis of 666ghj/MiroFish@b5b53acc57 (2026-08-14).
Data as JSON: /api/errors/f04f136c9f74483f.
Report an issue: GitHub.