`click.edit` on Windows throws WinError 14001 or 87
Author: emorynbCreated Sep 5, 2026Updated Sep 14, 2026
I found this bug while testing my own Click application. In about half the times click.edit() is attempted on Windows, notepad.exe will fail to launch with one of these two error messages (output under spoilers):
PS C:\Users\Emory> python .\click-notepad-me.py
Traceback (most recent call last):
File "C:\Users\Emory\AppData\Local\Python\pythoncore-3.14-64\Lib\site-packages\click\_termui_impl.py", line 729, in edit_files
c = subprocess.Popen(
args=shlex.split(editor) + list(filenames),
env=environ,
)
File "C:\Users\Emory\AppData\Local\Python\pythoncore-3.14-64\Lib\subprocess.py", line 1038, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pass_fds, cwd, env,
^^^^^^^^^^^^^^^^^^^
...<5 lines>...
gid, gids, uid, umask,
^^^^^^^^^^^^^^^^^^^^^^
start_new_session, process_group)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Emory\AppData\Local\Python\pythoncore-3.14-64\Lib\subprocess.py", line 1552, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
# no special security
^^^^^^^^^^^^^^^^^^^^^
...<4 lines>...
cwd,
^^^^
startupinfo)
^^^^^^^^^^^^
OSError: [WinError 87] The parameter is incorrect
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\Emory\click-notepad-me.py", line 3, in <module>
_ = click.edit()
File "C:\Users\Emory\AppData\Local\Python\pythoncore-3.14-64\Lib\site-packages\click\termui.py", line 904, in edit
return ed.edit(text)
~~~~~~~^^^^^^
File "C:\Users\Emory\AppData\Local\Python\pythoncore-3.14-64\Lib\site-packages\click\_termui_impl.py", line 783, in edit
self.edit_files((name,))
~~~~~~~~~~~~~~~^^^^^^^^^
File "C:\Users\Emory\AppData\Local\Python\pythoncore-3.14-64\Lib\site-packages\click\_termui_impl.py", line 739, in edit_files
raise ClickException(
_("{editor}: Editing failed: {e}").format(editor=editor, e=e)
) from e
click.exceptions.ClickException: notepad: Editing failed: [WinError 87] The parameter is incorrector
OSError: [WinError 14001] The application has failed to start because its side-by-side configuration is incorrect. Please see the application event log or use the command-line sxstrace.exe tool for more detailPS C:\Users\Emory> python .\click-notepad-me.py
Traceback (most recent call last):
File "C:\Users\Emory\AppData\Local\Python\pythoncore-3.14-64\Lib\site-packages\click\_termui_impl.py", line 729, in edit_files
c = subprocess.Popen(
args=shlex.split(editor) + list(filenames),
env=environ,
)
File "C:\Users\Emory\AppData\Local\Python\pythoncore-3.14-64\Lib\subprocess.py", line 1038, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pass_fds, cwd, env,
^^^^^^^^^^^^^^^^^^^
...<5 lines>...
gid, gids, uid, umask,
^^^^^^^^^^^^^^^^^^^^^^
start_new_session, process_group)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Emory\AppData\Local\Python\pythoncore-3.14-64\Lib\subprocess.py", line 1552, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
# no special security
^^^^^^^^^^^^^^^^^^^^^
...<4 lines>...
cwd,
^^^^
startupinfo)
^^^^^^^^^^^^
OSError: [WinError 14001] The application has failed to start because its side-by-side configuration is incorrect. Please see the application event log or use the command-line sxstrace.exe tool for more detail
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\Emory\click-notepad-me.py", line 3, in <module>
_ = click.edit()
File "C:\Users\Emory\AppData\Local\Python\pythoncore-3.14-64\Lib\site-packages\click\termui.py", line 904, in edit
return ed.edit(text)
~~~~~~~^^^^^^
File "C:\Users\Emory\AppData\Local\Python\pythoncore-3.14-64\Lib\site-packages\click\_termui_impl.py", line 783, in edit
self.edit_files((name,))
~~~~~~~~~~~~~~~^^^^^^^^^
File "C:\Users\Emory\AppData\Local\Python\pythoncore-3.14-64\Lib\site-packages\click\_termui_impl.py", line 739, in edit_files
raise ClickException(
_("{editor}: Editing failed: {e}").format(editor=editor, e=e)
) from e
click.exceptions.ClickException: notepad: Editing failed: [WinError 14001] The application has failed to start because its side-by-side configuration is incorrect. Please see the application event log or use the command-line sxstrace.exe tool for more detailTo replicate, run this script until you get one of these:
import click
_ = click.edit()
print("If you got here, no crash occurred")Environment:
- Python version: 3.12.14 / also reproduced on my system 3.14 install
- Click version: 8.5.0
- OS: Windows 11 (64-bit)
Source: pallets/click