{"record":{"id":"3ca4257c77608c71","repo":"FoundationAgents/MetaGPT","slug":"invalid-exp-mode-args-exp-mode","errorCode":null,"errorMessage":"Invalid exp_mode: {args.exp_mode}","messagePattern":"Invalid exp_mode: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"metagpt/ext/sela/run_experiment.py","lineNumber":93,"sourceCode":"async def main(args):\n    if args.exp_mode == \"mcts\":\n        runner = MCTSRunner(args)\n    elif args.exp_mode == \"greedy\":\n        runner = MCTSRunner(args, tree_mode=\"greedy\")\n    elif args.exp_mode == \"random\":\n        runner = MCTSRunner(args, tree_mode=\"random\")\n    elif args.exp_mode == \"rs\":\n        runner = RandomSearchRunner(args)\n    elif args.exp_mode == \"base\":\n        runner = Runner(args)\n    elif args.exp_mode == \"autogluon\":\n        runner = GluonRunner(args)\n    elif args.exp_mode == \"custom\":\n        runner = CustomRunner(args)\n    elif args.exp_mode == \"autosklearn\":\n        runner = AutoSklearnRunner(args)\n    else:\n        raise ValueError(f\"Invalid exp_mode: {args.exp_mode}\")\n    await runner.run_experiment()\n\n\nif __name__ == \"__main__\":\n    args = get_args()\n    asyncio.run(main(args))\n","sourceCodeStart":75,"sourceCodeEnd":100,"githubUrl":"https://github.com/FoundationAgents/MetaGPT/blob/11cdf466d042aece04fc6cfd13b28e1a70341b1f/metagpt/ext/sela/run_experiment.py#L75-L100","documentation":"Raised by SELA's experiment entrypoint when --exp_mode is not one of the recognized runners: 'mcts' (tree_mode random), 'rs' (RandomSearchRunner), 'base', 'autogluon', 'custom', 'autosklearn'. The dispatch is an if/elif chain with this final else.","triggerScenarios":"Running run_experiment.py with an unknown --exp_mode value, e.g. 'mcts-improved', 'random', or a typo like 'autogluon ' with trailing whitespace.","commonSituations":"Typos on the CLI; using an exp_mode documented in a different SELa version; copy-pasting a command from a fork that added new modes.","solutions":["Use one of: mcts, rs, base, autogluon, custom, autosklearn","Check for typos/whitespace in the --exp_mode argument","Run with --help to list the choices supported by your installed version"],"exampleFix":"# before\npython -m metagpt.ext.sela.run_experiment --exp_mode random ...\n\n# after\npython -m metagpt.ext.sela.run_experiment --exp_mode rs ...","handlingStrategy":"validation","validationCode":"import argparse\nparser.add_argument(\"--exp_mode\", choices=[\"mcts\", \"rs\", \"base\", \"autogluon\", \"custom\", \"autosklearn\"])  # argparse then rejects bad values for you","typeGuard":"def is_valid_exp_mode(mode: str) -> bool:\n    return mode in {\"mcts\", \"rs\", \"base\", \"autogluon\", \"custom\", \"autosklearn\"}","tryCatchPattern":null,"preventionTips":["Use choices= in argparse for enum-like CLI options","Check --help output for the installed version before running"],"tags":["sela","cli","validation","config"],"backgroundTag":null,"analyzedSha":"11cdf466d042aece04fc6cfd13b28e1a70341b1f","analyzedAt":"2026-08-14T23:20:02.994Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}