Diffusion error: [Invalid Translation!] Unable to determine the installed version of binary "%s". This version is required

I guess this is related to Unknown ‘hg’ Version .

I updated Phabricator in my PC today, using stable branch, then this error happened. This made my repository in diffusion unavailable.

I didn’t take care of not displaying hg version before this, because it looked no harmful, but now this became a serious problem to me.

Can anyone help?

I updated mercurial version up to 4.3.1 and its hg --version displays as bellow.

$ hg --version
Mercurial - 分散構成管理ツール(バージョン 4.3.1)
(詳細は https://mercurial-scm.org を参照)

Copyright (C) 2005-2017 Matt Mackall and others
本製品はフリーソフトウェアです。
頒布条件に関しては同梱されるライセンス条項をお読みください。
市場適合性や特定用途への可否を含め、 本製品は無保証です。

And this is the another one when I added LANG=C

$ LANG=C hg --version
Mercurial - ?????????(????? 4.3.1)
(??? https://mercurial-scm.org ???)

Copyright (C) 2005-2017 Matt Mackall and others
????????????????
??????????????????????????????
?????????????????? ??????????

OS is ubuntu 16.04 that is localized in Japanese language.

We don’t recommend running Phabricator server in a non-EN language. Lots of parsing issues.

https://secure.phabricator.com/T12942 is the relevant upstream task on the recent changes.

Also, I’m not really sure what the exact error you are seeing is. I expect this to be a “Config Issue” you can just ignore. Can you use Phabricator in english and give me a screenshot of the exact error.

At first, as you said, I’m using phabricator in non-EN localized OS(ubuntu 16.04).
What I saw was:

  1. click “diffusion” menu at top page after log in.
  2. select a repository which is made by mercurial
  3. the error displayed as:

Unhandled Exception (“Exception”)
[Invalid Translation!] Unable to determine the installed version of binary “%s”. This version is required.

I guess it will be solved if I change the OS’s localization setting to EN environment.
I have been using phabricator for evaluating and managing my personal programming projects.
But I can’t change the entire locale of OS immediately for that reason, so I will consider what I can do.

Thanks!!

It’s the “invalid translation” that’s confusing to me personally. Is your personal account on Phabricator running in another language!

Yes, the phabricator is running on my PC, which is localized in Japanese Language. I’m using it as a localhost service

$ echo $LANG
ja_JP.UTF-8
$ ps aux | grep phd
phabric+ 13945  0.0  0.2 326476 10220 ?        Ss   04:30   0:05 php ./phd-daemon

by the way, I will try to find how phablicator find mercurial version. if it finds using hg --version command, this translation error may be fixed by using LANGUAGE=en_US.utf8 hg --version.

$ LANGUAGE=en_US.utf8 hg --version
Mercurial Distributed SCM (version 4.2)
(see https://mercurial-scm.org for more information)

Copyright (C) 2005-2017 Matt Mackall and others
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Sorry, when I say “personal account” I mean your account translation settings on Phabricator.

Settings -> Translation

Should I set something to translation.override ?? The current value is {}.

That is the site configuration. I’m talking about your Personal Account Settings.

Click on your avatar in the menu bar, click on Settings. Translation is the first option.

1 Like

I think the [Invalid Translation!] is a pht error in our code. But reading the code, it’s not obvious how to trigger the error.

Thanks! I finally realized what translation settings was.
My setting was “Default (English(US))”, same as the above screen shot.

I haven’t used PHP for professional use, so this is just what I guess…

This error seems to be caused by the exception which is thrown at requireBinaryVersion() in libphutil/src/filesystem/binary/PhutilBinaryAnalyzer.php.

requireBinaryVersion() is called by either isMercurialFilesCommandAvailable() or isMercurialVulnerableToInjection(), which are defined in libphutil/src/filesystem/binary/PhutilMercurialBinaryAnalyzer.php.
I don’t know which function is invoked when a repository is selected in diffusion’s page.

Anyway, requireBinaryVersion() calls newBinaryVersion() indirectly. And the newBinaryVersion() is an abstract method. The concrete method is PhutilMercurialBinaryAnalyzer’s one.

PhutilMercurialBinaryAnalyzer’s new BinaryVersion() calls exec_manual('hg --version --quiet'). This seems to return null in my case. And that causes the exception in requireBinaryVersion() after all.

If my guess right, I agree it looks strange because hg --version --quiet usually succeed.

$ hg --version --quiet
Mercurial - 分散構成管理ツール(バージョン 4.3.1)

$ echo $?
0

The message is translated in Japanese, but exit code is 0.

UPDATE:
I overlooked parseMercurialBinaryVersion() that is defined in libphutil/src/filesystem/binary/PhutilMercurialBinaryAnalyzer.php.

public static function parseMercurialBinaryVersion($stdout) {
    // NOTE: At least on OSX, recent versions of Mercurial report this
    // string in this format:
    //
    //   Mercurial Distributed SCM (version 3.1.1+20140916)

    $matches = null;
    $pattern = '/^Mercurial Distributed SCM \(version ([\d.]+)/m';
    if (preg_match($pattern, $stdout, $matches)) {
      return $matches[1];
    }

    return null;
}

It seems that the regular expression doesn’t fit and returns null in my environment and now I can understand why the exception happens.

The exception is a translation issue, we shouldn’t be hitting that. It should render a Setup Issue that allows you to ignore the warning. I’ll see if I can get you a patch to test.

I think I have a reproduction case.

We’ve fixed the translation error. The underlying version information is a known issue already being tracked there:

https://secure.phabricator.com/T7339

This has been solved by updating phabricator.
https://secure.phabricator.com/D18610

The update was enabled at ‘2017 Week 37 (Mid September)’ for both current and stable branches.
https://secure.phabricator.com/w/changelog/2017.37/