666ghj/MiroFish · error · ValueError
模拟配置不存在: {simulation_id}
Error message
模拟配置不存在: {simulation_id} What it means
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.
Source
Thrown at backend/app/services/simulation_runner.py:1848
simulation_id: 模拟ID
prompt: 采访问题(所有Agent使用相同问题)
platform: 指定平台(可选)
- "twitter": 只采访Twitter平台
- "reddit": 只采访Reddit平台
- None: 双平台模拟时每个Agent同时采访两个平台
timeout: 超时时间(秒)
Returns:
全局采访结果字典
"""
sim_dir = os.path.join(cls.RUN_STATE_DIR, simulation_id)
if not os.path.exists(sim_dir):
raise ValueError(f"模拟不存在: {simulation_id}")
# 从配置文件获取所有Agent信息
config_path = os.path.join(sim_dir, "simulation_config.json")
if not os.path.exists(config_path):
raise ValueError(f"模拟配置不存在: {simulation_id}")
with open(config_path, 'r', encoding='utf-8') as f:
config = json.load(f)
agent_configs = config.get("agent_configs", [])
if not agent_configs:
raise ValueError(f"模拟配置中没有Agent: {simulation_id}")
# 构建批量采访列表
interviews = []
for agent_config in agent_configs:
agent_id = agent_config.get("agent_id")
if agent_id is not None:
interviews.append({
"agent_id": agent_id,
"prompt": prompt
})
View on GitHub (pinned to b5b53acc57)
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.
Example fix
// before
resp = SimulationRunner.interview_all_agents(sim_id, prompt); // dir exists, config missing
// after
config_path = Path(SimulationRunner.RUN_STATE_DIR) / sim_id / "simulation_config.json"
if not config_path.is_file():
raise FileNotFoundError(f"config missing for {sim_id}; restart the simulation")
resp = SimulationRunner.interview_all_agents(sim_id, prompt); Defensive patterns
Strategy: validation
Validate before calling
def has_config(sim_id: str) -> bool:
return (Path(SimulationRunner.RUN_STATE_DIR) / sim_id / "simulation_config.json").is_file() Try / catch
try:
SimulationRunner.interview_all_agents(sim_id, prompt)
except ValueError as e:
if str(e).startswith("模拟配置不存在"):
raise HTTPException(409, detail="run incomplete; restart simulation")
raise Prevention
- 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.
When it happens
Trigger: 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.
Common situations: Post-mortem inspection of a failed STARTING run; file-transfer/backup tools that skipped the JSON; crashes between directory creation and config persistence.
Related errors
- 模拟配置中没有Agent: {simulation_id}
- 等待命令响应超时 ({timeout}秒)
- 模拟不存在: {simulation_id}
- 没有找到符合条件的实体,请检查图谱是否正确构建
- 不支持的平台: {platform}
AI-assisted analysis of 666ghj/MiroFish@b5b53acc57 (2026-08-14).
Data as JSON: /api/errors/bfd503756fbc72f9.
Report an issue: GitHub.