Skip to content

fix(launcher): escape parens in winget error echo (fixes 'is was unexpected at this time.')#26

Merged
oahsiao merged 1 commit into
mainfrom
fix/launcher-winget-paren-parse
Jun 23, 2026
Merged

fix(launcher): escape parens in winget error echo (fixes 'is was unexpected at this time.')#26
oahsiao merged 1 commit into
mainfrom
fix/launcher-winget-paren-parse

Conversation

@oahsiao

@oahsiao oahsiao commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Problem

Launching M2_LOG.cmd (or M2_LOG_Admin.cmd) on machines without Node.js failed with:

[INFO] Node.js not found. Trying automatic install via winget ...
is was unexpected at this time.

Root cause

In the :ensure_node subroutine, the error echo contained unescaped parentheses inside an if errorlevel 1 (...) block:

if errorlevel 1 (
    echo [ERROR] winget (App Installer) is not available; cannot auto-install Node.js.
    exit /b 1
)

cmd.exe structurally parses the whole if (...) block before running it, treating (App Installer) as a nested group. The word is right after the inner ) then becomes an unexpected token, aborting the block.

Why only "some" computers

Machines that already have Node.js hit the early exit /b 0 in :ensure_node and never reach this branch. Only machines missing Node.js fall through to the broken block, so the error appeared selectively. M2_LOG_Admin.cmd is affected too since it calls M2_LOG.cmd.

Fix

Escape the parentheses with ^:

echo [ERROR] winget ^(App Installer^) is not available; cannot auto-install Node.js.

The block now parses correctly and the printed text is unchanged.

Verification

Reproduced the failure with a minimal repro (is was unexpected at this time.) and confirmed the escaped version prints winget (App Installer) is not available... cleanly. Grepped both .cmd files; this was the only echo with unescaped parens.

…e error

Unescaped parentheses in '(App Installer)' inside the 'if errorlevel 1 (...)' block made cmd.exe misparse the block, failing with 'is was unexpected at this time.' on machines without Node.js (the only path that reaches this branch). Escaping the parens as ^( ^) fixes the parse while keeping the printed text identical.
@oahsiao oahsiao merged commit c081751 into main Jun 23, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant