Skip to content

[Bug]: Windows font picker silently falls back to 5 hardcoded fonts when powershell.exe is Group Policy-blocked (listWindowsFonts spawns by bare name) #11771

Closed

Description

@sybdark

Summary

On managed/enterprise Windows where Group Policy blocks Windows PowerShell 5.1, listWindowsFonts() always fails, and the terminal Font Family picker silently degrades to the 5 hardcoded entries from fallbackFonts() — with no error surfaced anywhere. Users reasonably conclude that installing a font broke their font list.

This is distinct from #7573 (renderer truncating a good list with .slice(0, 320), already fixed). Here the main process never produces a list at all.

Environment

  • Orca 1.4.161 (desktop, Windows)
  • Windows 11 Enterprise 10.0.26200, corporate-managed
  • 311 font families actually installed (verified via InstalledFontCollection)

Actual

Settings → Terminal → Font Family shows only:

Cascadia Mono, Consolas, Lucida Console, JetBrains Mono, Fira Code

The tell is that JetBrains Mono and Fira Code are not installed on this machine — so this is provably fallbackFonts() output, not a filtered enumeration.

Root cause

listWindowsFonts() (in src/main/system-fonts.ts) spawns PowerShell by bare executable name:

function listWindowsFonts() {
  return execFileText("powershell.exe", ["-NoProfile", "-NonInteractive", "-ExecutionPolicy", "Bypass", "-Command", `...InstalledFontCollection...`], 8 * 1024 * 1024)
}

On Windows the machine PATH contains C:\Windows\System32\WindowsPowerShell\v1.0\ near the front, and it is always searched before any user PATH entry (user PATH is appended after machine PATH). So a bare powershell.exe deterministically resolves to Windows PowerShell 5.1 — which Group Policy blocks on this machine. CreateProcess then fails and Node reports:

Error: spawn UNKNOWN   errno: -4094

listSystemFontFamilies() catches that and silently substitutes the fallback:

fontsPromise = loadSystemFontFamilies().then((fonts) => {
  cachedFonts = fonts.length > 0 ? fonts : fallbackFonts(); return cachedFonts;
}).catch(() => { cachedFonts = fallbackFonts(); return cachedFonts; })

and the renderer keeps its previous state when the list comes back empty (fonts.length !== 0 && setFontSuggestions(...)), so nothing indicates a failure. The result is also memoised in cachedFonts for the whole app run.

Evidence

Probed with Node's execFile using exactly the PATH Orca's main process inherits (machine PATH + user PATH):

pwsh.exe         성공 (553ms): 폰트 311개
powershell.exe   실패:        spawn UNKNOWN (errno -4094)

Directly, for completeness:

PS 5.1 absolute path : This command cannot be run due to the error: 그룹 정책에서 이 프로그램을 차단했습니다.
pwsh 7               : exit 0, 311 families

Nothing appears in %APPDATA%\orca\logs\daemon.log or main.trace.ndjson, because the .catch() discards the error.

Suggested fix

  1. Don't spawn by bare name. Probe candidates in order and use the first that actually launches — e.g. pwsh.exe (PowerShell 7) first, then an absolute %WINDIR%\System32\WindowsPowerShell\v1.0\powershell.exe. Preferring pwsh also avoids the 5.1 startup cost.
  2. Better: don't spawn a shell for this at all. The font families are readable without a child process — the registry (HKLM/HKCU\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts), or the renderer's queryLocalFonts() (the codebase already has a navigator.fonts.query() / window.queryLocalFonts() path elsewhere), or a native module. That removes the whole class of "the shell we shell out to is policy-blocked" failure.
  3. Do not fail silently. When enumeration fails, log it and ideally show a hint in the picker ("couldn't read system fonts — showing defaults"). Silently serving 5 fonts, two of which aren't installed, sends users chasing the wrong cause. Also consider not caching a failed result for the process lifetime, so a retry is possible.

Note: same pattern elsewhere

The bare-name / hardcoded-absolute-path assumption about PowerShell shows up in more than one place. getWindowsSystemToolPath (used for ACL hardening of the E2EE keypair and device registry) resolves %WINDIR%\System32\WindowsPowerShell\v1.0\powershell.exe absolutely, which on this machine throws for the same Group Policy reason and takes down transport startup with it. A single shared "find a usable PowerShell" helper — preferring pwsh, verifying it actually launches — would fix both.

Local workarounds (for others hitting this)

  • The Font Family control accepts free text, so a font missing from the dropdown can still be applied by typing its name.
  • The shipped app.asar can be patched in place without repacking, because a byte-length-preserving substitution keeps every asar header offset valid: "powershell.exe" → "pwsh.exe"/*pp*/ (16 bytes → 16 bytes). There is exactly one execFileText("powershell.exe" call site. Restores the full 311-font list after restarting Orca. Reverts on update, obviously.

Activity

  1. nwparker commented on Aug 22, 2026

    @nwparker
    Contributor

    Partially addressed by #15746.

    PowerShell is now spawned by absolute System32 path rather than bare name, so the PATH-resolution half is fixed.

    Still open: the Group Policy half. Font enumeration still shells out to PowerShell, so a policy block still degrades to the five hardcoded families. Reading HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts via the registry dependency already in package.json would remove that — the wrinkle is deriving families from per-style registry names.

  2. nwparker commented on Aug 22, 2026

    @nwparker
    Contributor

    Partially fixed on main; the half you named as the root cause is gone, the visible symptom is not. Verified from code — no need for you to re-test yet.

    Fixed. The bare-name spawn is gone. listWindowsFonts() now goes through windowsPowerShellPath(), which resolves an absolute path (and skips the Store App Execution Alias stub), and through the shared runProcess chokepoint added in #15749. So the PATH-order and alias-stub failure modes no longer apply.

    Not fixed. Your actual scenario. On a host where Group Policy blocks Windows PowerShell outright, an absolute path does not help: the spawn still fails and the picker still degrades to the 5 entries from fallbackFonts() with nothing surfaced.

    The real fix is to stop asking PowerShell. windows-native-registry is already a dependency of the app, and HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts enumerates installed families with no subprocess at all — which also removes the 8 MB buffer, the timeout, and the UTF-8 console-encoding workaround from #12590.

    Queued as W3b in the Windows/WSL root-cause plan. Leaving open.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions