Skip to content

Conversation

@cderv
Copy link
Collaborator

@cderv cderv commented Dec 22, 2025

When x64 R crashes on Windows ARM, Quarto shows a generic "check your R installation" error instead of explaining the actual problem. This leaves users stuck with no clear path forward.

Root Cause

x64 R running under emulation on Windows ARM crashes with specific exit codes when loading the rmarkdown package. The R script completes successfully and produces valid YAML output before crashing during process termination.

Two crash scenarios observed:

  • Native ARM hardware: Exit code -1073741569 (STATUS_NOT_SUPPORTED)
  • Windows ARM VM on Mac: Exit code -1073741819 (STATUS_ACCESS_VIOLATION)

Fix

Detect these specific exit codes and throw WindowsArmX64RError with a helpful message directing users to install native ARM64 R.

This approach is simpler than PR #13790's YAML parsing method - just 8 lines of error code checking vs 30+ lines of regex matching and YAML parsing.

Implementation

src/core/knitr.ts:

  • Added WindowsArmX64RError class for type-safe error handling
  • Check for both exit codes when knitrCapabilities() fails on Windows ARM
  • Rethrow error from catch block to preserve helpful message
  • Error bubbles up through quarto check to display to user

Testing

Requires Windows ARM hardware to test:

  • With x64 R installed: Should show helpful error message
  • With ARM64 R installed: Should work normally
  • On x64 Windows: Should not trigger (not ARM)
  • On macOS/Linux: Should not affect behavior

Closes #8730
Related: #13790

@cderv cderv self-assigned this Dec 22, 2025
@posit-snyk-bot
Copy link
Collaborator

posit-snyk-bot commented Dec 22, 2025

Snyk checks have passed. No issues have been found so far.

Status Scanner Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@cderv
Copy link
Collaborator Author

cderv commented Dec 22, 2025

Tested on https://github.com/cderv/quarto-windows-arm/actions/

With quarto render we get
image

With quarto check
image

When x64 R crashes on Windows ARM, detect specific exit codes and provide
helpful error message instead of generic "check your R installation".

Detects two crash scenarios:
- Native ARM hardware: -1073741569 (STATUS_NOT_SUPPORTED)
- Windows ARM VM on Mac: -1073741819 (STATUS_ACCESS_VIOLATION)

Both occur when rmarkdown package loads under x64 emulation. R script
completes successfully and produces YAML before crashing during cleanup.

These error codes are unique to x64 R on ARM Windows, so checking them
directly is sufficient without needing to verify ARM hardware via Windows API.

Closes #8730
Related: #13790
Add references to issue #8730 and quarto-windows-arm test repository
in code comments to help future contributors understand the context.
Make error message more actionable:
- Show detected error code
- Explain x64 R on Windows ARM issue
- Provide step-by-step fix instructions
- Link to issue #8730 for context
Use errorOnce() instead of rethrowing WindowsArmX64RError to prevent
duplicate error messages when printCallRDiagnostics() calls
knitrCapabilities() again. Returns undefined like other knitrCapabilities
errors without changing general error handling in callR().
Extract x64 R crash detection into helper function for better code
organization. Function name clearly indicates it throws on detection.
@cderv cderv force-pushed the fix/windows-arm-r-error-code branch from 1765bdd to 07470f5 Compare December 22, 2025 16:48
@cderv cderv requested a review from cscheid December 22, 2025 16:49
@cderv
Copy link
Collaborator Author

cderv commented Dec 22, 2025

@cscheid, as discussed in last meeting, here is the option to look at the error code. I am checking two of them because there is the one I got from my test on windows ARM inside GitHub action and the one reported from Windows ARM in Mac emulation at #8730

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.

Quarto fails to detect knitr capabilities on Aarch64 Windows

3 participants