Hello Manuel,

This isn't new behavior, and I'd argue it is a bug on two counts, not just one.
First, the error message itself is wrong. "Name too long?" has nothing to do 
with path length. That string comes from R's internal filename encoding 
conversion routine on Windows, and it fires whenever the conversion between the 
native encoding and wide characters fails for any reason. A username with "á" 
in it isn't too long, it's failing translation. At minimum the error text 
should say what actually happened.
Second, the underlying conversion failure shouldn't be happening at all on a 
modern build. Since R 4.2 the Windows builds are UCRT-based with UTF-8 as the 
native encoding, which was supposed to put exactly this class of non-ASCII path 
problem to bed. If path.expand("~") still chokes on "á" in R 4.6.1, then some 
code path in the home directory derivation is still going through a lossy 
conversion, most likely where R falls back to the Windows shell folder APIs to 
locate Documents when R_USER is unset. That's consistent with what you're 
seeing: define R_USER and the problem vanishes, because R takes the environment 
string as-is instead of deriving the path itself. GitHub
This has been reported to R-core before in nearly identical form. There's a 
2024 r-help thread with the same error, same root cause (a home path containing 
non-ASCII characters), where the recommended workaround was the same one you 
found: set R_USER before launching R. Tomas Kalibera responded at the time that 
he couldn't find an obvious place where the Windows code gets the conversion 
wrong and couldn't reproduce it without OneDrive involved, so the reproduction 
details matter here. A couple of diagnostics worth adding to your report to 
make it actionable for R-core: The Mail Archive

Output of sessionInfo() and Sys.getlocale() on an affected machine
Whether OneDrive is redirecting the Documents folder on the affected accounts 
(localized folder names like "Documentos" plus OneDrive path injection is the 
common thread in prior reports)
Output of 
utils::readRegistry("Software\Microsoft\Windows\CurrentVersion\Explorer\User 
Shell Folders", "HCU") so they can see the raw path R is trying to convert

The same conversion failure also surfaces downstream in anything that calls 
file.exists(), so this isn't cosmetic. Since you've confirmed it across 
multiple machines on Win10 and Win11, this belongs on R's Bugzilla 
(bugs.r-project.org) rather than just a package repo issue tracker, because the 
fault is in base R, not Rcmdr. GitHub
The .Renviron workaround is fine as a stopgap, but users with accented 
usernames shouldn't need to know it exists.

In your particular case, ñ is non-ASCII (it sits outside the 7-bit ASCII range, 
at U+00F1). Maybe your life would be simpler if you drop the ~.

best regards,
Gregg Powell



On Wednesday, July 8th, 2026 at 8:53 AM, Manuel Muñoz Márquez 
<[email protected]> wrote:

> Dear all.
> 

> When using R version 4.6.1 on certain Windows platforms where the username 
> contains non-ASCII characters (such as "á"), the command:
> path.expand("~")
> fails with the following error:
> Error: file name conversion problem -- name too long?
> 

> This occurs when the Windows OS does not define the R_USER environment 
> variable. In these cases, a call to Sys.getenv("R_USER") returns an
> empty string ("").
> 

> However, if an .Renviron file is created with a valid path, such as:
> R_USER="C:\Users\%Username%\Documents"
> then path.expand() works properly no matter if which the %Username% is.
> 

> This error propagates to other functions that internally call path.expand(), 
> such as file.exists().
> 

> This behavior has been confirmed on multiple computers by various users 
> running Windows 10 and 11.
> 

> In my opinion, this is a bug, as a standard path expansion should not trigger 
> a conversion error under these circumstances. Or is this the
> expected behavior in this scenario?
> 

> More info:
> 

> https://github.com/RCmdr-Project/rcmdr/issues/8
> 

> Thank in advance.
> 

> --
> Manuel Muñoz Márquez <[email protected]>
> 

> ______________________________________________
> [email protected] mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide https://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 

Attachment: signature.asc
Description: OpenPGP digital signature

______________________________________________
[email protected] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide https://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to