{"record":{"id":"b57bb5a6b9b11dc5","repo":"lllyasviel/Fooocus","slug":"error-running-command-command-command-error-co","errorCode":null,"errorMessage":"Error running command.\nCommand: {command}\nError code: {result.returncode}\nstdout: {result.stdout}\nstderr: {result.stderr}","messagePattern":"Error running command\\.\nCommand: (.+?)\nError code: (.+?)\nstdout: (.+?)\nstderr: (.+?)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"critical","filePath":"modules/launch_util.py","lineNumber":62,"sourceCode":"        \"errors\": 'ignore',\n    }\n\n    if not live:\n        run_kwargs[\"stdout\"] = run_kwargs[\"stderr\"] = subprocess.PIPE\n\n    result = subprocess.run(**run_kwargs)\n\n    if result.returncode != 0:\n        error_bits = [\n            f\"{errdesc or 'Error running command'}.\",\n            f\"Command: {command}\",\n            f\"Error code: {result.returncode}\",\n        ]\n        if result.stdout:\n            error_bits.append(f\"stdout: {result.stdout}\")\n        if result.stderr:\n            error_bits.append(f\"stderr: {result.stderr}\")\n        raise RuntimeError(\"\\n\".join(error_bits))\n\n    return (result.stdout or \"\")\n\n\ndef run_pip(command, desc=None, live=default_command_live):\n    try:\n        index_url_line = f' --index-url {index_url}' if index_url != '' else ''\n        return run(f'\"{python}\" -m pip {command} --prefer-binary{index_url_line}', desc=f\"Installing {desc}\",\n                   errdesc=f\"Couldn't install {desc}\", live=live)\n    except Exception as e:\n        print(e)\n        print(f'CMD Failed {desc}: {command}')\n        return None\n\n\ndef requirements_met(requirements_file):\n    with open(requirements_file, \"r\", encoding=\"utf8\") as file:\n        for line in file:","sourceCodeStart":44,"sourceCodeEnd":80,"githubUrl":"https://github.com/lllyasviel/Fooocus/blob/ae05379cc97bc4361ec8b4ec90193dab21be763f/modules/launch_util.py#L44-L80","documentation":"run() in modules/launch_util.py is Fooocus's subprocess wrapper used at startup (pip installs, git fetches for updates). When a command exits nonzero it raises RuntimeError composed of errdesc, the command, the exit code, and captured stdout/stderr — the RuntimeError itself is just the report; the real failure is in those captured streams (or, with live=True, already printed to the console).","triggerScenarios":"launch.py downloading a model or running 'python -m pip install …' when PyPI is unreachable, a package has no wheel for the Python version, a git update fetch fails, or a dependency conflicts — any subprocess in the launch sequence exiting != 0.","commonSituations":"Offline/proxied networks breaking pip; Python 3.12 vs pins in requirements_versions.txt; full disk or permission-denied during model download; a partially upgraded environment after a repo update.","solutions":["Read the stderr/stdout lines in the exception (or the live console output above it) — they identify the actual failing command and cause.","Retry the printed command manually, e.g. '\"/path/python\" -m pip install <pkg> --prefer-binary', to iterate on the fix outside the launcher.","For network issues fix connectivity/mirror (set pip index-url) or pre-download the model file into the expected folder so launch skips it.","If a pinned version won't build, install a compatible wheel of that package first, then rerun launch.py."],"exampleFix":"# before: launch.py aborts with RuntimeError from run()\n# after: run the failed command manually with verbose output\npython -m pip install <failed-package> --prefer-binary -v\n# then re-run: python launch.py","handlingStrategy":"try-catch","validationCode":"import shutil\nfor tool in ('git', 'python'):\n    if shutil.which(tool) is None:\n        raise RuntimeError(f'{tool} not on PATH — launch will fail')","typeGuard":null,"tryCatchPattern":"from modules.launch_util import run\ntry:\n    out = run(cmd, errdesc='installing deps')\nexcept RuntimeError as e:\n    print(e)  # includes command, exit code, stdout, stderr\n    # inspect e args, fix env (network/pip index/permissions), then re-run launch\n    raise SystemExit(1)","preventionTips":["Pre-install requirements_versions.txt in a controlled venv/Docker layer so launch-time pip runs are no-ops.","Check the captured stderr field first — it names the real failing command; the RuntimeError is only the envelope.","Keep disk space and network/mirror settings healthy before running launch.py; avoid re-running the identical failing command unchanged."],"tags":["subprocess","pip","launch","installation","environment","network"],"backgroundTag":null,"analyzedSha":"ae05379cc97bc4361ec8b4ec90193dab21be763f","analyzedAt":"2026-08-15T04:23:59.533Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}