Skip to content

Conversation

@cderv
Copy link
Collaborator

@cderv cderv commented Dec 12, 2025

When x64 R fails on Windows ARM, parse YAML output to detect the architecture mismatch and provide a specific error message with ARM64 R download links instead of the generic "check your R installation" message.

Also adds platform information to quarto check output with warning when x64 R is detected on ARM Windows.

This is draft PR because I need to check this work as expected in windows ARM runner

@posit-snyk-bot
Copy link
Collaborator

posit-snyk-bot commented Dec 12, 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 and others added 3 commits December 16, 2025 18:09
Detects x64 R running on Windows ARM and provides helpful error message
with ARM64 R download guidance instead of generic installation message.

Implementation details:
- Parses YAML output to detect architecture mismatch
- Uses custom WindowsArmX64RError for type-safe error handling
- Detects in both success and failure paths (emulation is intermittent)
- Ensures error displays in quarto check output

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Deno.build.arch reports x86_64 even when x64 Deno runs on ARM64 hardware
under emulation. Use Windows IsWow64Process2 API via FFI to detect the
actual native hardware architecture.

This fixes the x64-on-ARM detection so the custom error message displays
instead of the generic "Please check your installation of R" message.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Performance improvements:
- Check isX64R first to short-circuit when R is ARM64 (correct setup)
- Only check ARM architecture when R fails (x64 R on ARM always crashes)
- Avoids FFI overhead for all successful R checks

Documentation:
- Explains why kernel32.dll FFI is needed and safe
- Links to validation repo and Microsoft API docs

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
cderv added a commit that referenced this pull request Dec 22, 2025
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.

This simpler approach checks exit codes directly rather than parsing YAML
output to detect architecture strings.

Closes #8730
Related: #13790
cderv added a commit that referenced this pull request Dec 22, 2025
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.

This is the simplest possible approach: just check exit codes, no DLL calls.

Closes #8730
Related: #13790
@cderv
Copy link
Collaborator Author

cderv commented Dec 22, 2025

As discussed, I think we'll start with simpler than trying to detect Windows ARM from deno x64 using a dll for Windows API. #13822 is about simplifying by checking error code.

Use errorOnce() instead of rethrowing WindowsArmX64RError to prevent
duplicate error messages when printCallRDiagnostics() calls
knitrCapabilities() again.

This scoped fix:
- Only affects WindowsArmX64RError handling
- Returns undefined like other knitrCapabilities errors
- Doesn't change general error handling in callR()
- Applies to both catch blocks that handle this error type
cderv added a commit that referenced this pull request Dec 22, 2025
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
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.

3 participants