[GH-ISSUE #3339] [Bug] Restart command strips quotes from CLI arguments containing spaces #1145

Open
opened 2026-10-27 21:26:12 +00:00 by bsakaguchi · 0 comments
Owner

Originally created by @gershu-ar on GitHub (Oct 3, 2026).
Original GitHub issue: https://github.com/Comfy-Org/ComfyUI-Manager/issues/3339

Describe the bug
When ComfyUI-Manager restarts ComfyUI after installing or updating custom nodes, by clicking on the UI's Restart button, it reconstructs the startup command directly from sys.argv. Since sys.argv elements lose their original shell quotes during Python initialization, joining them without escaping or re-quoting causes space-containing arguments to break upon restart.

How to reproduce

  1. Launch ComfyUI using any CLI argument that contains spaces wrapped in quotes, for example:
    python main.py --browser-profile "Profile 1"
  2. Update an extension or trigger a restart via ComfyUI-Manager.
  3. Observe the restart command generated by Manager:
    Command: [..., '--browser-profile', 'Profile 1']
  4. main.py crashes on boot with main.py: error: unrecognized arguments: 1 because Profile 1 was passed without quotes.

Expected behavior
Arguments in sys.argv containing spaces should be safely escaped or re-quoted (lusing shlex.quote() or subprocess.list2cmdline()) when rebuilding the restart command line string.

Originally created by @gershu-ar on GitHub (Oct 3, 2026). Original GitHub issue: https://github.com/Comfy-Org/ComfyUI-Manager/issues/3339 **Describe the bug** When ComfyUI-Manager restarts ComfyUI after installing or updating custom nodes, by clicking on the UI's `Restart` button, it reconstructs the startup command directly from `sys.argv`. Since `sys.argv` elements lose their original shell quotes during Python initialization, joining them without escaping or re-quoting causes space-containing arguments to break upon restart. **How to reproduce** 1. Launch ComfyUI using any CLI argument that contains spaces wrapped in quotes, for example: `python main.py --browser-profile "Profile 1"` 2. Update an extension or trigger a restart via ComfyUI-Manager. 3. Observe the restart command generated by Manager: `Command: [..., '--browser-profile', 'Profile 1']` 4. `main.py` crashes on boot with `main.py: error: unrecognized arguments: 1` because `Profile 1` was passed without quotes. **Expected behavior** Arguments in `sys.argv` containing spaces should be safely escaped or re-quoted (lusing `shlex.quote()` or `subprocess.list2cmdline()`) when rebuilding the restart command line string.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Comfy-Org/ComfyUI-Manager#1145
No description provided.