{"record":{"id":"f04f136c9f74483f","repo":"666ghj/MiroFish","slug":"zep-e","errorCode":null,"errorMessage":"Zep图谱更新器初始化失败: {e}","messagePattern":"Zep图谱更新器初始化失败: (.+?)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"backend/app/services/simulation_runner.py","lineNumber":461,"sourceCode":"                raise ValueError(\"启用图谱记忆更新时必须提供 graph_id\")\n            \n            try:\n                ZepGraphMemoryManager.create_updater(simulation_id, graph_id)\n                cls._graph_memory_enabled[simulation_id] = True\n                logger.info(f\"已启用图谱记忆更新: simulation_id={simulation_id}, graph_id={graph_id}\")\n            except Exception as e:\n                logger.error(f\"创建图谱记忆更新器失败: {e}\")\n                cls._graph_memory_enabled[simulation_id] = False\n                state.runner_status = RunnerStatus.FAILED\n                state.error = f\"Zep图谱更新器初始化失败: {e}\"\n                with cls._finalization_lock(simulation_id):\n                    cls._save_run_state(state)\n                    cls._sync_simulation_status(\n                        simulation_id,\n                        RunnerStatus.FAILED,\n                        state.error,\n                    )\n                raise RuntimeError(state.error) from e\n        else:\n            cls._graph_memory_enabled[simulation_id] = False\n        \n        # 确定运行哪个脚本（脚本位于 backend/scripts/ 目录）\n        if platform == \"twitter\":\n            script_name = \"run_twitter_simulation.py\"\n            state.twitter_running = True\n        elif platform == \"reddit\":\n            script_name = \"run_reddit_simulation.py\"\n            state.reddit_running = True\n        else:\n            script_name = \"run_parallel_simulation.py\"\n            state.twitter_running = True\n            state.reddit_running = True\n        \n        script_path = os.path.join(cls.SCRIPTS_DIR, script_name)\n        \n        if not os.path.exists(script_path):","sourceCodeStart":443,"sourceCodeEnd":479,"githubUrl":"https://github.com/666ghj/MiroFish/blob/b5b53acc57189a4a42e44a23e149dc655c98fe82/backend/app/services/simulation_runner.py#L443-L479","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"# before\nrunner.start_simulation(sim_id, enable_graph_memory_update=True, graph_id=graph_id)\n# after\n# verify updater prerequisites before starting\nassert Config.ZEP_API_KEY, 'ZEP_API_KEY required for graph memory'\nzep_client = Zep(api_key=Config.ZEP_API_KEY)\nzep_client.graph.get(graph_id=graph_id)  # fails fast with the real error\nrunner.start_simulation(sim_id, enable_graph_memory_update=True, graph_id=graph_id)","handlingStrategy":"try-catch","validationCode":"assert Config.ZEP_API_KEY, 'ZEP_API_KEY required for graph memory updates'\nzep_client = Zep(api_key=Config.ZEP_API_KEY)\nzep_client.graph.get(graph_id=graph_id)  # fail fast with the real Zep error before starting","typeGuard":null,"tryCatchPattern":"try:\n    SimulationRunner.start_simulation(sim_id, enable_graph_memory_update=True, graph_id=graph_id)\nexcept RuntimeError as e:\n    if 'Zep图谱更新器初始化失败' in str(e) and e.__cause__:\n        diagnose(e.__cause__)  # the chained cause holds the real failure (auth/network/graph)\n    raise","preventionTips":["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."],"tags":["simulation","zep","graph-memory","initialization","auth"],"backgroundTag":null,"analyzedSha":"b5b53acc57189a4a42e44a23e149dc655c98fe82","analyzedAt":"2026-08-14T22:29:33.146Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}