Repository navigation
Description
System details
RStudio Edition : Desktop
RStudio Version : 2026.11.0+203 (affects 2026.09.0 and later)
OS Version : macOS (any R); Windows (R < 4.2)
R Version : see OS Version
Steps to reproduce the problem
- Use a machine whose hostname contains a non-ASCII character, e.g.
josé-MacBook. To simulate one without changing the system hostname, launch RStudio with aHOSTNAMEenvironment variable set:- macOS:
HOSTNAME='josé-MacBook' /Applications/RStudio.app/Contents/MacOS/RStudio - Windows (PowerShell), with RStudio configured to use R 4.1 or earlier:
$env:HOSTNAME = 'josé-MacBook'; & 'C:\Program Files\RStudio\rstudio.exe'
- macOS:
- Install or update Posit Assistant from the chat pane.
Describe the problem in detail
Each install extracts into a staging directory named .tmp-<hostname>-<pid>-<uuid>. stagingDirName() in src/cpp/session/modules/chat/ChatSlots.cpp truncates the hostname to 32 bytes, then sanitizes it one byte at a time with std::isalnum(), which depends on the locale. If a byte 0x80-0xFF passes, the name is no longer valid UTF-8. The truncation can also split a multi-byte character.
macOS. The install fails with "Update failed: Installation failed: Illegal byte sequence" at the top of the chat pane, and every retry fails the same way. rsession runs in a UTF-8 locale, where macOS isalnum() treats bytes 0x80-0xFF as Latin-1 characters. For é (UTF-8 C3 A9), C3 passes (Ã) and A9 (©) becomes _, so josé-MacBook becomes jos\xC3_-MacBook. APFS rejects the mkdir with EILSEQ.
Windows, R < 4.2 (tested with R 4.1.3). The install fails with:
Update failed: Installation failed: Downloaded package declares version " for protocol", but version '1.12.0' for protocol '11.0' was requested
Every attempt also leaves a full extracted package (~23 MB) behind in %LOCALAPPDATA%\RStudio\pai\versions. With R < 4.2, rsession runs as rsession.exe in the system code page locale (e.g. English_Canada.1252), where the UCRT's isalnum() accepts Latin-1 letters such as C3 and E9. So josé-MacBook sanitizes to jos\xC3_-MacBook (from HOSTNAME, which arrives as UTF-8) or keeps jos\xE9-MacBook (from gethostname(), which returns the ANSI code page). The directory is still created, because FilePath converts the invalid UTF-8 to wide characters with U+FFFD in its place. But installPackage() passes that path to R's unzip(exdir=) as a native-encoded string, so R reads the U+FFFD bytes EF BF BD as cp1252 � and extracts into a different directory. verifyDeclaredIdentity() then reads the empty staging directory, so the version and protocol come back blank. The empty directory is removed; the extracted one is orphaned.
Not affected:
- Windows with R 4.2 and later: rsession runs as
rsession-utf8.exein a.utf8locale, where the UCRT'sisalnum()rejects every byte 0x80-0xFF.josé-MacBookbecomesjos__-MacBookand the install succeeds. - Linux: glibc's
isalnum()rejects every byte 0x80-0xFF in UTF-8 locales.
Workarounds:
- macOS: set an ASCII hostname, e.g.
sudo scutil --set HostName jose-MacBook, then retry. - Windows: use R 4.2 or later. On R 4.0/4.1, setting
HOSTNAMEto an ASCII name before launching RStudio should also work, since rsession readsHOSTNAMEbefore the computer name (not tested).
Describe the behavior you expected
Posit Assistant installs regardless of the hostname. The staging directory name should keep only ASCII letters, digits, - and . from the hostname, independent of locale.
Activity
[-]Posit Assistant install fails with "Illegal byte sequence" on macOS when the hostname has non-ASCII characters[/-][+]Posit Assistant install fails on macOS, and on Windows with R < 4.2, when the hostname has non-ASCII characters[/+]Fail the hostname tests when no high-byte locale can be set
Drop the flag that Linux builds set but never read
Keep only ASCII from the hostname in Posit Assistant staging director…