{"record":{"id":"14fb0dfe1fb97250","repo":"rust-lang/rust","slug":"failed-to-run-args","errorCode":null,"errorMessage":"failed to run: {args}","messagePattern":"failed to run: (.+?)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"critical","filePath":"src/bootstrap/bootstrap.py","lineNumber":237,"sourceCode":"\n\ndef run(args, verbose=0, exception=False, is_bootstrap=False, **kwargs):\n    \"\"\"Run a child program in a new process\"\"\"\n    if verbose > 0:\n        eprint(\"running: \" + \" \".join(args))\n    sys.stdout.flush()\n    # Ensure that the .exe is used on Windows just in case a Linux ELF has been\n    # compiled in the same directory.\n    if os.name == \"nt\" and not args[0].endswith(\".exe\"):\n        args[0] += \".exe\"\n    # Use Popen here instead of call() as it apparently allows powershell on\n    # Windows to not lock up waiting for input presumably.\n    ret = subprocess.Popen(args, **kwargs)\n    code = ret.wait()\n    if code != 0:\n        err = \"failed to run: \" + \" \".join(args)\n        if verbose > 0 or exception:\n            raise RuntimeError(err)\n        # For most failures, we definitely do want to print this error, or the user will have no\n        # idea what went wrong. But when we've successfully built bootstrap and it failed, it will\n        # have already printed an error above, so there's no need to print the exact command we're\n        # running.\n        if is_bootstrap:\n            sys.exit(1)\n        else:\n            sys.exit(err)\n\n\ndef run_powershell(script, *args, **kwargs):\n    \"\"\"Run a powershell script\"\"\"\n    run([\"PowerShell.exe\", \"/nologo\", \"-Command\"] + script, *args, **kwargs)\n\n\ndef require(cmd, exit=True, exception=False):\n    \"\"\"Run a command, returning its output.\n    On error,","sourceCodeStart":219,"sourceCodeEnd":255,"githubUrl":"https://github.com/rust-lang/rust/blob/7088e4b63a9516ebfbfe2ab2d999cf01a528ac14/src/bootstrap/bootstrap.py#L219-L255","documentation":"Raised or sys.exit'd by run() in bootstrap.py at line 235-245 when a child process returns a non-zero exit code. If verbose > 0 or exception=True, it raises RuntimeError; otherwise it calls sys.exit with the error message (or sys.exit(1) if is_bootstrap is true, since the bootstrap binary already printed its own error). The function is the central process-execution helper for Python bootstrap.","triggerScenarios":"run(args, ...) spawns the command via subprocess.Popen at line 232, waits for it at line 233, and at line 234 finds code != 0. This fires for any external command bootstrap runs that fails: building bootstrap itself via cargo, running the compiled bootstrap binary (line 1414), running curl for downloads, or any helper process. The error message includes the full argument list.","commonSituations":"The bootstrap cargo build fails (missing dependencies, compilation error); the compiled rust bootstrap binary crashes; curl fails to download stage0 artifacts; a required system tool (git, cmake, ninja) is missing or returns an error; or an incompatible system library breaks the build.","solutions":["Re-run with increased verbosity (x.py -vv) to see the exact command and its output before the failure.","Read the child process's own stderr/stdout which is printed above the 'failed to run' message.","Verify all build prerequisites are installed (gcc/g++, cmake, ninja, python3, git) per https://github.com/rust-lang/rust#building-from-source.","Check for disk space, memory, or file-descriptor limits that could cause the child process to fail.","If building bootstrap, ensure the cargo and rustc from stage0 are functional."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"# Pre-check that the command exists before running it\nimport shutil, os\ndef command_available(cmd):\n    return os.path.isfile(cmd) or shutil.which(cmd) is not None","typeGuard":null,"tryCatchPattern":"try:\n    run(args, verbose=verbose, exception=True)\nexcept RuntimeError as e:\n    if 'failed to run' in str(e):\n        print(f'Command failed: {\" \".join(args)}')\n        print('Check prerequisites: gcc, cmake, ninja, python3, git.')\n    raise","preventionTips":["Install all build prerequisites before running x.py (gcc, g++, cmake, ninja, python3, git).","Run with -vv for maximum verbosity to capture the failing command's full output.","Ensure sufficient disk space and memory for the build.","Keep the stage0 toolchain functional — a broken stage0 compiler cascades into bootstrap build failures."],"tags":["bootstrap","rustc","child-process","build-failure","python"],"backgroundTag":null,"analyzedSha":"7088e4b63a9516ebfbfe2ab2d999cf01a528ac14","analyzedAt":"2026-08-10T14:17:03.603Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}