{"record":{"id":"e6867bafa8b69f73","repo":"ultralytics/ultralytics","slug":"a-is-a-valid-yolo-argument-but-is-missing-an","errorCode":null,"errorMessage":"'{a}' is a valid YOLO argument but is missing an '=' sign to set its value, i.e. try '{a}={DEFAULT_CFG_DICT[a]}'\n{CLI_HELP_MSG}","messagePattern":"'(.+?)' is a valid YOLO argument but is missing an '=' sign to set its value, i\\.e\\. try '(.+?)=(.+?)'\n(.+?)","errorType":"validation","errorClass":"SyntaxError","httpStatus":null,"severity":"error","filePath":"ultralytics/cfg/__init__.py","lineNumber":1039,"sourceCode":"                    overrides = {k: val for k, val in YAML.load(checks.check_yaml(v)).items() if k != \"cfg\"}\n                else:\n                    overrides[k] = v\n            except (NameError, SyntaxError, ValueError, AssertionError) as e:\n                check_dict_alignment(full_args_dict, {a: \"\"}, e)\n\n        elif a in TASKS:\n            overrides[\"task\"] = a\n        elif a in MODES:\n            overrides[\"mode\"] = a\n        elif a.lower() in special:\n            special[a.lower()]()\n            return\n        elif a in DEFAULT_CFG_DICT and isinstance(DEFAULT_CFG_DICT[a], bool):\n            overrides[a] = True  # auto-True for default bool args, i.e. 'yolo show' sets show=True\n        elif a in {\"half\", \"int8\"}:\n            overrides[a] = True  # deprecated bare precision flags, forwarded to quantize by _handle_deprecation\n        elif a in DEFAULT_CFG_DICT:\n            raise SyntaxError(\n                f\"'{colorstr('red', 'bold', a)}' is a valid YOLO argument but is missing an '=' sign \"\n                f\"to set its value, i.e. try '{a}={DEFAULT_CFG_DICT[a]}'\\n{CLI_HELP_MSG}\"\n            )\n        else:\n            check_dict_alignment(full_args_dict, {a: \"\"})\n\n    # Check keys\n    check_dict_alignment(full_args_dict, overrides)\n\n    # Mode\n    mode = overrides.get(\"mode\")\n    if mode is None:\n        mode = DEFAULT_CFG.mode or \"predict\"\n        LOGGER.warning(f\"'mode' argument is missing. Valid modes are {list(MODES)}. Using default 'mode={mode}'.\")\n    elif mode not in MODES:\n        raise ValueError(f\"Invalid 'mode={mode}'. Valid modes are {list(MODES)}.\\n{CLI_HELP_MSG}\")\n\n    # Task","sourceCodeStart":1021,"sourceCodeEnd":1057,"githubUrl":"https://github.com/ultralytics/ultralytics/blob/0449ea011cfd6c9a0d50a0bf1043aca5190cd476/ultralytics/cfg/__init__.py#L1021-L1057","documentation":"In the yolo CLI parser, a bare token that matches a default.yaml key is only legal without '=' if the key is boolean (auto-set True), a deprecated precision flag, a task, or a mode. For any other key (e.g. epochs, imgsz, data) a bare token means you forgot '=value', so SyntaxError is raised suggesting 'key=default' plus the CLI help.","triggerScenarios":"`yolo predict model=yolo26n.pt epochs` (missing =100), `yolo train data` , `yolo val imgsz` — any non-bool cfg key given as a standalone word on the command line. Works fine for bool keys: `yolo predict show` sets show=True.","commonSituations":"Shell quoting that splits on '=' (e.g. writing yolo train epochs = 100 with spaces); muscle memory from tools where flags and values are separate arguments; scripts concatenating args with spaces around '=' (merge_equals_args handles some but not all splits — only in CLI entrypoint).","solutions":["Attach the value with '=': yolo train epochs=100 imgsz=640.","Remove spaces around '=' in generated command lines.","For boolean keys keep the bare-flag form: yolo predict show (no value needed).","Run yolo settings or yolo help to review accepted keys."],"exampleFix":"# before\nyolo predict model=yolo26n.pt source=bus.jpg epochs\n\n# after\nyolo predict model=yolo26n.pt source=bus.jpg epochs=100","handlingStrategy":"validation","validationCode":"from ultralytics.cfg import DEFAULT_CFG_DICT\n\ndef build_cli_tokens(args: dict[str, str]) -> list[str]:\n    tokens = []\n    for k, v in args.items():\n        if isinstance(DEFAULT_CFG_DICT.get(k), bool) and v is True:\n            tokens.append(k)          # bare bool flag\n        else:\n            tokens.append(f\"{k}={v}\")  # everything else needs '='\n    return tokens","typeGuard":null,"tryCatchPattern":"try:\n    run_yolo_cli(cmd)\nexcept SyntaxError as e:\n    if \"missing an '=' sign\" in str(e):\n        fix = re.sub(r\"(?<=\\s)(\\w+)(?=\\s|$)\", r\"\\1=\", raw_cmd)  # or fix by hand\n        raise SystemExit(f\"Fix command to: {fix}\") from e\n    raise","preventionTips":["Always join key and value with '=' and no spaces when generating yolo commands.","Remember bare tokens are only valid for bool keys (yolo predict show).","Test generated CLI strings with yolo help or a dry parse before executing."],"tags":["cli","syntax","arguments","usage"],"backgroundTag":null,"analyzedSha":"0449ea011cfd6c9a0d50a0bf1043aca5190cd476","analyzedAt":"2026-08-15T02:34:13.413Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}