Skip to content

Posit Assistant install fails on macOS, and on Windows with R < 4.2, when the hostname has non-ASCII characters #19624

Closed

Description

@gtritchie

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

  1. 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 a HOSTNAME environment 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'
  2. 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.exe in a .utf8 locale, where the UCRT's isalnum() rejects every byte 0x80-0xFF. josé-MacBook becomes jos__-MacBook and 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 HOSTNAME to an ASCII name before launching RStudio should also work, since rsession reads HOSTNAME before 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

  1. added theissue type on Nov 13, 2026
  2. self-assigned this
    on Nov 13, 2026
  3. changed the title [-]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[/+] on Nov 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions