{"record":{"id":"bfd503756fbc72f9","repo":"666ghj/MiroFish","slug":"simulation-id-bfd503","errorCode":null,"errorMessage":"模拟配置不存在: {simulation_id}","messagePattern":"模拟配置不存在: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"backend/app/services/simulation_runner.py","lineNumber":1848,"sourceCode":"            simulation_id: 模拟ID\n            prompt: 采访问题（所有Agent使用相同问题）\n            platform: 指定平台（可选）\n                - \"twitter\": 只采访Twitter平台\n                - \"reddit\": 只采访Reddit平台\n                - None: 双平台模拟时每个Agent同时采访两个平台\n            timeout: 超时时间（秒）\n\n        Returns:\n            全局采访结果字典\n        \"\"\"\n        sim_dir = os.path.join(cls.RUN_STATE_DIR, simulation_id)\n        if not os.path.exists(sim_dir):\n            raise ValueError(f\"模拟不存在: {simulation_id}\")\n\n        # 从配置文件获取所有Agent信息\n        config_path = os.path.join(sim_dir, \"simulation_config.json\")\n        if not os.path.exists(config_path):\n            raise ValueError(f\"模拟配置不存在: {simulation_id}\")\n\n        with open(config_path, 'r', encoding='utf-8') as f:\n            config = json.load(f)\n\n        agent_configs = config.get(\"agent_configs\", [])\n        if not agent_configs:\n            raise ValueError(f\"模拟配置中没有Agent: {simulation_id}\")\n\n        # 构建批量采访列表\n        interviews = []\n        for agent_config in agent_configs:\n            agent_id = agent_config.get(\"agent_id\")\n            if agent_id is not None:\n                interviews.append({\n                    \"agent_id\": agent_id,\n                    \"prompt\": prompt\n                })\n","sourceCodeStart":1830,"sourceCodeEnd":1866,"githubUrl":"https://github.com/666ghj/MiroFish/blob/b5b53acc57189a4a42e44a23e149dc655c98fe82/backend/app/services/simulation_runner.py#L1830-L1866","documentation":"interview_all_agents requires simulation_config.json inside the run directory to discover agents; if the run directory exists but that file is missing, ValueError('模拟配置不存在') is raised. This means the run state dir is present but incomplete — config was never written, was moved, or was deleted.","triggerScenarios":"Run directory created but startup failed before writing simulation_config.json; manual deletion or partial copy of the run directory; a hand-crafted sim_dir without config.","commonSituations":"Post-mortem inspection of a failed STARTING run; file-transfer/backup tools that skipped the JSON; crashes between directory creation and config persistence.","solutions":["Check whether the simulation ever reached RUNNING — if start failed, restart it so config is regenerated.","Restore simulation_config.json from the source config used at start time (the same payload POSTed to the start endpoint).","If you only need run artifacts (not interviews), use the artifacts/logs endpoints instead of interview_all_agents."],"exampleFix":"// before\nresp = SimulationRunner.interview_all_agents(sim_id, prompt); // dir exists, config missing\n\n// after\nconfig_path = Path(SimulationRunner.RUN_STATE_DIR) / sim_id / \"simulation_config.json\"\nif not config_path.is_file():\n    raise FileNotFoundError(f\"config missing for {sim_id}; restart the simulation\")\nresp = SimulationRunner.interview_all_agents(sim_id, prompt);","handlingStrategy":"validation","validationCode":"def has_config(sim_id: str) -> bool:\n    return (Path(SimulationRunner.RUN_STATE_DIR) / sim_id / \"simulation_config.json\").is_file()","typeGuard":null,"tryCatchPattern":"try:\n    SimulationRunner.interview_all_agents(sim_id, prompt)\nexcept ValueError as e:\n    if str(e).startswith(\"模拟配置不存在\"):\n        raise HTTPException(409, detail=\"run incomplete; restart simulation\")\n    raise","preventionTips":["Write simulation_config.json atomically at run start, before the env boots.","Never partially copy run directories between hosts.","Treat missing config as an incomplete run: restart rather than reconstruct."],"tags":["simulation","global-interview","missing-config","partial-state"],"backgroundTag":null,"analyzedSha":"b5b53acc57189a4a42e44a23e149dc655c98fe82","analyzedAt":"2026-08-14T22:29:33.146Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}