lllyasviel/Fooocus · critical · RuntimeError

Error running command. Command: {command} Error code: {resul

Error message

Error running command.
Command: {command}
Error code: {result.returncode}
stdout: {result.stdout}
stderr: {result.stderr}

What it means

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).

Source

Thrown at modules/launch_util.py:62

        "errors": 'ignore',
    }

    if not live:
        run_kwargs["stdout"] = run_kwargs["stderr"] = subprocess.PIPE

    result = subprocess.run(**run_kwargs)

    if result.returncode != 0:
        error_bits = [
            f"{errdesc or 'Error running command'}.",
            f"Command: {command}",
            f"Error code: {result.returncode}",
        ]
        if result.stdout:
            error_bits.append(f"stdout: {result.stdout}")
        if result.stderr:
            error_bits.append(f"stderr: {result.stderr}")
        raise RuntimeError("\n".join(error_bits))

    return (result.stdout or "")


def run_pip(command, desc=None, live=default_command_live):
    try:
        index_url_line = f' --index-url {index_url}' if index_url != '' else ''
        return run(f'"{python}" -m pip {command} --prefer-binary{index_url_line}', desc=f"Installing {desc}",
                   errdesc=f"Couldn't install {desc}", live=live)
    except Exception as e:
        print(e)
        print(f'CMD Failed {desc}: {command}')
        return None


def requirements_met(requirements_file):
    with open(requirements_file, "r", encoding="utf8") as file:
        for line in file:

View on GitHub (pinned to ae05379cc9)

Solutions

  1. Read the stderr/stdout lines in the exception (or the live console output above it) — they identify the actual failing command and cause.
  2. Retry the printed command manually, e.g. '"/path/python" -m pip install <pkg> --prefer-binary', to iterate on the fix outside the launcher.
  3. For network issues fix connectivity/mirror (set pip index-url) or pre-download the model file into the expected folder so launch skips it.
  4. If a pinned version won't build, install a compatible wheel of that package first, then rerun launch.py.

Example fix

# before: launch.py aborts with RuntimeError from run()
# after: run the failed command manually with verbose output
python -m pip install <failed-package> --prefer-binary -v
# then re-run: python launch.py
Defensive patterns

Strategy: try-catch

Validate before calling

import shutil
for tool in ('git', 'python'):
    if shutil.which(tool) is None:
        raise RuntimeError(f'{tool} not on PATH — launch will fail')

Try / catch

from modules.launch_util import run
try:
    out = run(cmd, errdesc='installing deps')
except RuntimeError as e:
    print(e)  # includes command, exit code, stdout, stderr
    # inspect e args, fix env (network/pip index/permissions), then re-run launch
    raise SystemExit(1)

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of lllyasviel/Fooocus@ae05379cc9 (2026-08-15). Data as JSON: /api/errors/b57bb5a6b9b11dc5. Report an issue: GitHub.