{"record":{"id":"5aa0c2afcfc4d740","repo":"dotnet/runtime","slug":"coreclr-args-mode","errorCode":null,"errorMessage":"{coreclr_args.mode}","messagePattern":"\\{coreclr_args\\.mode\\}","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"src/coreclr/scripts/jitrollingbuild.py","lineNumber":720,"sourceCode":"    logger.setLevel(logging.INFO)\n\n    if sys.version_info.major < 3:\n        logging.error(\"Please install python 3 or greater\")\n        return 1\n\n    coreclr_args = setup_args(args)\n\n    if coreclr_args.mode == \"upload\":\n        upload_command(coreclr_args)\n\n    elif coreclr_args.mode == \"download\":\n        download_command(coreclr_args)\n\n    elif coreclr_args.mode == \"list\":\n        list_command(coreclr_args)\n\n    else:\n        raise NotImplementedError(coreclr_args.mode)\n\n    # Note that if there is any failure, an exception is raised and the process exit code is then `1`\n    return 0\n\n################################################################################\n# __main__\n################################################################################\n\n\nif __name__ == \"__main__\":\n    args = parser.parse_args()\n    sys.exit(main(args))\n","sourceCodeStart":702,"sourceCodeEnd":733,"githubUrl":"https://github.com/dotnet/runtime/blob/60108ba66eb7d1d12f595480091b4ad80a24b172/src/coreclr/scripts/jitrollingbuild.py#L702-L733","documentation":"Raised by main() in jitrollingbuild.py as `raise NotImplementedError(coreclr_args.mode)` when coreclr_args.mode is not one of 'upload', 'download', or 'list'. The mode comes from the argparse subparser dest='mode'; an unrecognized or unset mode reaches the else branch.","triggerScenarios":"Invoking the script with a subcommand name that is not upload/download/list, or calling main() programmatically with an args object whose mode attribute is None or an unsupported string.","commonSituations":"Typo in the subcommand; invoking the script with no subcommand on argparse versions that do not enforce required subparsers; programmatic misuse of setup_args/main.","solutions":["Use one of the supported subcommands: upload, download, or list (e.g. `jitrollingbuild.py list`).","Run `jitrollingbuild.py -h` to see the valid subcommands.","If scripting against main(), ensure args.mode is set to a valid value before calling."],"exampleFix":"// before\npython jitrollingbuild.py downlodd   # typo -> NotImplementedError\n// after\npython jitrollingbuild.py download -git_hash abc","handlingStrategy":"validation","validationCode":"SUPPORTED_MODES = {\"upload\", \"download\", \"list\"}\nif coreclr_args.mode not in SUPPORTED_MODES:\n    raise SystemExit(f\"Unsupported mode {coreclr_args.mode!r}; choose from {sorted(SUPPORTED_MODES)}\")","typeGuard":"def is_known_mode(m: str) -> bool:\n    return m in {\"upload\", \"download\", \"list\"}","tryCatchPattern":null,"preventionTips":["When calling main() programmatically, set args.mode to a valid subcommand string.","Use argparse subparsers with required=True so an unset mode fails at parse time."],"tags":["jit-rolling-build","argument-validation","cli","python"],"backgroundTag":null,"analyzedSha":"60108ba66eb7d1d12f595480091b4ad80a24b172","analyzedAt":"2026-08-10T18:54:11.478Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}