You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
uucore translations are once per-thread, which can lead to untranslated error names #19004
I have done a basic search of the issue tracker to find any existing issues that are similar.
I have checked that my version is at least the latest stable release available via my installation method.
Describe the bug
disclaimer: based on my very shallow understanding of uutils. hopefully it's correct.
uucore has a translate! macro which uses localized names for error message ids
to use this, you first call an initializer with the name of the util. this initialization is thread local
so this system assumes one uucore util per thread
...which nushell doesn't do
this means if it was already loaded for one util, an error for a different util in the same nu thread might give an untranslated error name
How to reproduce
both of these must start from a fresh session of nu
> mktemp foo
Error: nu::shell::error
× too few X's in template 'foo'
╭────
1 │ crates/nu-command/src/filesystem/mktemp.rs:119:48
· ────────────────────────┬────────────────────────
· ╰── too few X's in template 'foo'
╰────
I looked into this. The cause is in uucore, so nushell can't fix it on its side. In uucore/src/lib/mods/locale.rs, both levels keep whichever util was set up first:
setup_localization() returns early once any util has been set up on the current thread, so a later localized_help_template("mktemp") does nothing.
In the embedded-locale path, which nushell uses, each util's strings are cached in a single process-wide UTIL_FLUENT: OnceLock. So even a fresh thread gets the first util's strings: [1] | par-each {|_| uname | ignore }; mktemp foo also prints mktemp-error-too-few-xs.
The error types call translate! in their Display impls, so there's nothing to route around in nushell. I tested a small uucore patch (a per-util cache, and rebuilding the thread's localizer when the util changes) through [patch.crates-io]. With it, all of the cases above print the translated message.
I've opened uutils/coreutils#15040 upstream with the repro and proposed fix, and I'll bump uucore here once it lands. Separately, platform/whoami.rs passes "touch" to localized_help_template. I'll fix that in a small PR.
Activity
mkdir errors on already-created dir (#19006)
aakarshitv commentedon Oct 3, 2026
I looked into this. The cause is in
uucore, so nushell can't fix it on its side. Inuucore/src/lib/mods/locale.rs, both levels keep whichever util was set up first:setup_localization()returns early once any util has been set up on the current thread, so a laterlocalized_help_template("mktemp")does nothing.UTIL_FLUENT: OnceLock. So even a fresh thread gets the first util's strings:[1] | par-each {|_| uname | ignore }; mktemp fooalso printsmktemp-error-too-few-xs.The error types call
translate!in theirDisplayimpls, so there's nothing to route around in nushell. I tested a small uucore patch (a per-util cache, and rebuilding the thread's localizer when the util changes) through[patch.crates-io]. With it, all of the cases above print the translated message.I've opened uutils/coreutils#15040 upstream with the repro and proposed fix, and I'll bump uucore here once it lands. Separately,
platform/whoami.rspasses"touch"tolocalized_help_template. I'll fix that in a small PR.fdncred commentedon Oct 3, 2026
Thanks. I assume someone will have to submit a PR to get it fixed. Do you have time to do that?
aakarshitv commentedon Oct 3, 2026
Yes, I'm down to work on that
aakarshitv commentedon Oct 3, 2026
Opened both:
uname | ignore; mktemp foorepro against a nushell build with the patch, and the error is translated now.whoamicommand #19144 is the small nushell-side fix wherewhoamiwas loadingtouch's translations.Once uutils/coreutils#15044 is merged and released, nushell just needs a uucore bump.
Use whoami's own uucore locale in the `whoami` command (#19144)