`comfy launch --background` fails with FileNotFoundError when comfy-cli is invoked by path
I maintainer di solito rispondono entro 1 giorno
@RaphaelFakhri ci sta già lavorando.
Dal 2/10/2026.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 78/100
Direzione di ricerca
Inizia in comfy_cli/command/launch.py, in background_launch(), e ispeziona come viene costruito e avviato il comando passato a subprocess.Popen. Esegui nuovamente la riproduzione con virtualenv, con comfy assente da PATH, quindi verifica che la stessa CLI invocata tramite percorso possa essere avviata in background senza un FileNotFoundError e che il Workspace venga eseguito.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Describe the bug
background_launch() re-execs the CLI as a bare "comfy" through subprocess.Popen (no shell=True), so the child is resolved via PATH. When comfy-cli is invoked by its own path from a virtualenv that hasn't been activated — e.g. /path/to/.venv/bin/comfy launch --background — the child spawn raises FileNotFoundError and the launch dies with an unhandled traceback.
This is a normal way to use a Python console script (it's how a script or launcher invokes a tool it installed into a project-local venv), and comfy-cli otherwise anchors subprocesses properly — resolve_python.py and uv.py use sys.executable throughout. Only this call site assumes PATH.
To Reproduce
python3 -m venv .venv-comfy
.venv-comfy/bin/pip install comfy-cli
# a stand-in workspace is enough to reach the failing call
mkdir -p fake-ws && echo 'print("hi")' > fake-ws/main.py
# the key condition: `comfy` is NOT on PATH
env -i HOME="$HOME" PATH=/usr/bin:/bin \
./.venv-comfy/bin/comfy --skip-prompt --workspace="$PWD/fake-ws" launch --background
Environment
- comfy-cli 1.15.0
- Python 3.11, Linux (originally hit on macOS / Apple silicon)
- comfy-cli installed into a project-local venv and invoked without activating it
Observed
FileNotFoundError: [Errno 2] No such file or directory: 'comfy'
…raised from comfy_cli/command/launch.py → background_launch → subprocess.Popen.
Expected behavior
The background launch should start, as it does when the same binary's directory happens to be on PATH. Re-running the identical command with only PATH="$PWD/.venv-comfy/bin:$PATH" changed gets past the spawn and executes the workspace — PATH is the only variable.
Cause
comfy_cli/command/launch.py, in background_launch():
cmd = [
"comfy",
f"--workspace={os.path.abspath(os.getcwd())}",
"launch",
]
...
process = subprocess.Popen(
cmd,
stdout=logfh,
stderr=subprocess.STDOUT,
env=env,
)
cmd[0] is a bare name, so Popen resolves it against PATH — which need not contain the comfy-cli that is currently running.
Suggested fix
Anchor the re-exec to the running installation rather than to PATH. Either of these is a no-op when comfy is on PATH:
cmd = [sys.argv[0], f"--workspace={...}", "launch"] # the path actually invoked
cmd = [sys.executable, "-m", "comfy_cli", f"--workspace={...}", "launch"] # interpreter-anchored
sys.executable-based spawning would also match what resolve_python.py / uv.py already do.
Secondary note
Because the failure happens after the parent prints Launching ComfyUI from: <workspace>, it reads as though ComfyUI itself failed to start, which sends you looking at the workspace and its models rather than at the CLI. Catching FileNotFoundError around the spawn and reporting something like "could not re-exec comfy; is it on PATH?" would make the failure self-explanatory even before the fix above.
Nice to have
- Terminal output
- Screenshots
Additional context
Add any other context about the problem here.
- Lingua principale
- Python
- Stelle
- 1k
- Fork
- 176
- Merge medio
- 1g 11h
- PR unite (30g)
- 87
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di Comfy-Org/comfy-cli
-
test_file_utils umask tests assert against a umask the code never reads (import-time _UMASK), so they only pass on a 0o022 hostForse già presa @neverbiasu l’ha presa 10 giorni fa. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
Comfy-Org/comfy-cli#907 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 92/100
Comfy-Org/comfy-cli#781 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
Comfy-Org/comfy-cli#670 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
UI→API conversion sends LOAD_3D viewport_state as "" where the frontend sends the viewport cameraAperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 53/100
Comfy-Org/comfy-cli#1126 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di Comfy-Org/comfy-cli
Issue simili
-
plot_graph crashes when a mesh node has no m2m edgeForse già presa @tygvi l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
mllam/neural-lam#883 · 1 commento ·
I maintainer di solito rispondono entro 2 giorni
-
enhancement possible-duplicate
Difficoltà 1/5 1-3 ore Idoneità per principianti 78/100
AOSSIE-Org/PictoPy#1715 · 2 commenti ·
I maintainer di solito rispondono entro 6 giorni
-
SQLite connector omits generated columns from the catalog, and drops relationships sourced on themAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
NVIDIA/auto-ontology#511 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
ethereum/execution-specs#3996 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
cpp-best-practices/project_validator#267 ·
I maintainer di solito rispondono entro 1 giorno