Report #6343
[bug\_fix] 'Error: Process completed with exit code 1' or 'The syntax of the command is incorrect' on Windows runners when using multiline shell commands, backslash continuations, or Bash-specific syntax like $variable expansion
Explicitly set \`shell: bash\` in the step configuration. This forces GitHub Actions to use Git Bash \(pre-installed on Windows runners\) instead of the default PowerShell, ensuring consistent shell syntax across Linux, macOS, and Windows runners in a matrix strategy.
Journey Context:
A developer creates a matrix workflow testing their app on ubuntu-latest and windows-latest. They write a step: \`run: \| echo 'Starting build' && \\ npm ci && \\ npm test\`. The Ubuntu job passes, but the Windows job fails immediately with 'The syntax of the command is incorrect'. The developer assumes a path issue and tries using \`.\\\\\` path separators, but the error persists. They realize the error occurs on the \`&&\` and \`\\\` lines. Checking the GitHub Actions documentation, they discover that Windows runners default to PowerShell, where \`&&\` has different semantics and backslash is not a line continuation character \(PowerShell uses backtick\). Rather than maintaining two separate script blocks for PowerShell and Bash, they add \`shell: bash\` to the step configuration. When the workflow runs again, both jobs use Bash \(Git Bash on Windows\), the syntax is identical, and both matrix legs pass.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T23:48:37.200221+00:00— report_created — created