You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Problem with git pre-push (ts-node) when it's powershell & ts-node.cmd #23154
Classification: Bug (partially), with a mixed/multi-issue report
This report bundles two technically different symptoms: (1) a pre-push npm run script invoking ts-node failing to resolve ts-node.cmd when PowerShell is configured as the hooks shell with a custom PATHEXT=.CPL, and (2) garbled (mojibake) non-ASCII hook output in the failure dialog. I'm suggesting bug for the encoding symptom, which is reproducible and plausibly a product issue, and more-info-needed because the PATHEXT/ts-node.cmd resolution failure needs more detail to confirm it's a Desktop bug versus an environment-specific PATHEXT misconfiguration, and because the "can't copy error text" complaint overlaps with other already-tracked issues and should be separated out.
Initial hypothesis: The raw hook stderr bytes are captured without any codepage/encoding conversion and then handed straight to an xterm.js Terminal instance for rendering, which assumes UTF-8 input; on Windows, child processes spawned via cmd/PowerShell typically emit console output in the system's OEM codepage (e.g. CP866 for Russian locales), not UTF-8, so bytes like those in the report ("ts-node" ‐‐ ... shown as �) would render as mojibake rather than being transcoded. In createHooksProxy, hook stderr chunks are collected into a Buffer[] and passed through to the UI as TerminalOutput (app/src/lib/hooks/hooks-proxy.ts), and the Terminal component writes those buffers directly to xterm without any encoding conversion step (
). This is consistent with the user's screenshot-free log excerpt showing corrupted Cyrillic text instead of readable error output. The separate "ts-node.cmd" / PATHEXT=.CPL resolution failure would need additional detail (exact PATHEXT value used, Node/npm version, and whether reproducible with default PATHEXT) to determine whether it's a genuine Desktop/hook-shell issue or an artifact of the user's customized PATHEXT.
Duplicate Check: No exact duplicate found. #22591 and #21785 (closed) cover inability to copy text from hook-failure/commit-failed modals on Windows — related to, but distinct from, this issue's encoding corruption and the separate ts-node/PATHEXT resolution problem; they don't address character encoding or PATHEXT. No existing issue specifically covers OEM-codepage mojibake in hook output or PATHEXT-based script resolution.
Suggested Next Steps: Ask the reporter to confirm (a) whether the ts-node resolution failure reproduces with default PATHEXT (i.e., is .CPL-only PATHEXT intentional or a system misconfiguration), and (b) their Windows display language/locale, to help confirm the OEM-codepage hypothesis for the garbled text. Consider filing the "can't copy text" complaint separately, referencing #22591.
PATHEXT normally includes several executable extensions, including .CMD, which allows commands such as ts-node to resolve to ts-node.cmd. If its complete value is just .CPL, that could explain the failure.
Could you share the full PATHEXT value both inside the failing hook and in a normal PowerShell session? Does the same hook work when you push from PowerShell outside GitHub Desktop? This would help us determine whether Desktop is loading the environment incorrectly.
Garbled error output
The unreadable characters appear related to #16892, which tracks Windows hook output being displayed incorrectly when it uses a non-UTF encoding. We can track that symptom separately from the command-resolution failure.
Could you also share your Windows system locale and PowerShell version to help us compare the reports?
@babakks I just reproduced the push failure with GitHub Desktop 3.6.12-beta2
The pre-push hook exited with code 1 when an npm script tried to run ts-node
In my earlier reproduction of the hook environment on 3.6.11-beta1, with Windows PowerShell selected as the hook shell, the full PATHEXT value was .CPL
The latest Desktop log does not include PATHEXT
In a regular Windows PowerShell session, the full value is:
I confirmed that PowerShell can resolve the local ts-node.cmd when node_modules\.bin is on PATH
A full push from PowerShell is still unverified
The commit completed successfully in GitHub Desktop
The failure reproduced on two subsequent push attempts, both when the pre-push hook tried to run ts-node
btw my win locale is ru-RU (ANSI code page 1251, OEM code page 866), and my PowerShell version: 5.1.19041.7725
I traced the PATHEXT=.CPL value reported here to the way Desktop loads the hook environment, and I opened #23245 with the details.
In short, getShellEnv (app/src/lib/hooks/get-shell-env.ts) spawns the shell with env: {}, so PATHEXT is missing. PowerShell then sets it to just .CPL, and the hook inherits that value, which is why .cmd shims like ts-node.cmd can't be resolved. Choosing Git Bash or Command Prompt as the hook shell works around it.
Activity
desktop-triage commentedon Nov 10, 2026
Classification: Bug (partially), with a mixed/multi-issue report
This report bundles two technically different symptoms: (1) a pre-push
npm runscript invokingts-nodefailing to resolvets-node.cmdwhen PowerShell is configured as the hooks shell with a customPATHEXT=.CPL, and (2) garbled (mojibake) non-ASCII hook output in the failure dialog. I'm suggestingbugfor the encoding symptom, which is reproducible and plausibly a product issue, andmore-info-neededbecause the PATHEXT/ts-node.cmdresolution failure needs more detail to confirm it's a Desktop bug versus an environment-specific PATHEXT misconfiguration, and because the "can't copy error text" complaint overlaps with other already-tracked issues and should be separated out.Initial hypothesis: The raw hook stderr bytes are captured without any codepage/encoding conversion and then handed straight to an xterm.js
Terminalinstance for rendering, which assumes UTF-8 input; on Windows, child processes spawned via cmd/PowerShell typically emit console output in the system's OEM codepage (e.g. CP866 for Russian locales), not UTF-8, so bytes like those in the report ("ts-node" ‐‐ ...shown as�) would render as mojibake rather than being transcoded. IncreateHooksProxy, hook stderr chunks are collected into aBuffer[]and passed through to the UI asTerminalOutput(app/src/lib/hooks/hooks-proxy.ts), and theTerminalcomponent writes those buffers directly to xterm without any encoding conversion step (desktop/app/src/ui/terminal.tsx
Lines 31 to 37 in edcf9a4
PATHEXT=.CPLresolution failure would need additional detail (exactPATHEXTvalue used, Node/npm version, and whether reproducible with defaultPATHEXT) to determine whether it's a genuine Desktop/hook-shell issue or an artifact of the user's customizedPATHEXT.Duplicate Check: No exact duplicate found. #22591 and #21785 (closed) cover inability to copy text from hook-failure/commit-failed modals on Windows — related to, but distinct from, this issue's encoding corruption and the separate ts-node/PATHEXT resolution problem; they don't address character encoding or PATHEXT. No existing issue specifically covers OEM-codepage mojibake in hook output or
PATHEXT-based script resolution.Suggested Next Steps: Ask the reporter to confirm (a) whether the
ts-noderesolution failure reproduces with defaultPATHEXT(i.e., is.CPL-only PATHEXT intentional or a system misconfiguration), and (b) their Windows display language/locale, to help confirm the OEM-codepage hypothesis for the garbled text. Consider filing the "can't copy text" complaint separately, referencing #22591.babakks commentedon Nov 17, 2026
Thanks for reporting this, @b5414! 🙏
Command resolution and PATHEXT
PATHEXTnormally includes several executable extensions, including.CMD, which allows commands such asts-nodeto resolve tots-node.cmd. If its complete value is just.CPL, that could explain the failure.Could you share the full
PATHEXTvalue both inside the failing hook and in a normal PowerShell session? Does the same hook work when you push from PowerShell outside GitHub Desktop? This would help us determine whether Desktop is loading the environment incorrectly.Garbled error output
The unreadable characters appear related to #16892, which tracks Windows hook output being displayed incorrectly when it uses a non-UTF encoding. We can track that symptom separately from the command-resolution failure.
Could you also share your Windows system locale and PowerShell version to help us compare the reports?
b5414 commentedon Nov 23, 2026
@babakks I just reproduced the push failure with GitHub Desktop
3.6.12-beta2The
pre-pushhook exited with code1when an npm script tried to runts-nodeIn my earlier reproduction of the hook environment on
3.6.11-beta1, with Windows PowerShell selected as the hook shell, the fullPATHEXTvalue was.CPLThe latest Desktop log does not include
PATHEXTIn a regular Windows PowerShell session, the full value is:
I confirmed that PowerShell can resolve the local
ts-node.cmdwhennode_modules\.binis onPATHA full push from PowerShell is still unverified
The commit completed successfully in GitHub Desktop
The failure reproduced on two subsequent push attempts, both when the
pre-pushhook tried to runts-nodebtw my win locale is
ru-RU(ANSI code page1251, OEM code page866), and my PowerShell version:5.1.19041.7725Taiizor commentedon Nov 27, 2026
I traced the
PATHEXT=.CPLvalue reported here to the way Desktop loads the hook environment, and I opened #23245 with the details.In short,
getShellEnv(app/src/lib/hooks/get-shell-env.ts) spawns the shell withenv: {}, soPATHEXTis missing. PowerShell then sets it to just.CPL, and the hook inherits that value, which is why.cmdshims likets-node.cmdcan't be resolved. Choosing Git Bash or Command Prompt as the hook shell works around it.