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

  1. Read the chained exception (raise ... from e) — the log line '创建图谱记忆更新器失败' plus the cause names the actual failure; fix that first.
  2. Verify ZEP_API_KEY is set and valid, and that graph_id exists in Zep for the project.
  3. Test connectivity to Zep from the backend container (curl the Zep API endpoint) if network policy may block egress.
  4. 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

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


AI-assisted analysis of 666ghj/MiroFish@b5b53acc57 (2026-08-14). Data as JSON: /api/errors/f04f136c9f74483f. Report an issue: GitHub.