CLI crashes with error message: "panic: Failed to load system translations for 'en'"

Summary

I’m happily working with Mattermost 3.5.0 (Build Hash: 3f19ccf1b1a6efdcc990cf8a0270ec4ffc0c6e22, Build Date: Tue Nov 15 18:55:53 UTC 2016), which is bundled with the most recent GitLab Omnibus (8.14.1). I’ve never used the CLI before, so I don’t know if it worked in older releases.

Whenever I run the CLI with the -config option, I get the following error (it doesn’t matter if i sudo or not):

$ sudo -u mattermost /opt/gitlab/embedded/bin/mattermost -config=/var/opt/gitlab/mattermost/config.json -version
[2016/12/01 14:00:57 CET] [EROR] Failed to load system translations for 'en' attempting to fall back to 'en'
panic: Failed to load system translations for 'en'

goroutine 1 [running]:
panic(0xb5c580, 0xc4204b5af0)
        /usr/local/go/src/runtime/panic.go:500 +0x1a1
github.com/mattermost/platform/utils.GetTranslationsBySystemLocale(0x0)
        /var/lib/jenkins/jobs/msr/jobs/platform-release/workspace/src/github.com/mattermost/platform/utils/i18n.go:50 +0x374
github.com/mattermost/platform/utils.InitTranslations(0xc4204b55f0, 0xc4204b5600, 0xc4204b5610)
        /var/lib/jenkins/jobs/msr/jobs/platform-release/workspace/src/github.com/mattermost/platform/utils/i18n.go:27 +0x54
main.main()
        /var/lib/jenkins/jobs/msr/jobs/platform-release/workspace/src/github.com/mattermost/platform/mattermost.go:114 +0xa4

If I run the command without the path to the config file it complains, obviously, it can’t find the config file, but at least it doesn’t panic:

$ sudo -u mattermost /opt/gitlab/embedded/bin/mattermost -version
[14:02:45 CET 2016/12/01] [EROR] (main.main:107) Unable to load mattermost configuration file:  utils.config.load_config.opening.panic

I don’t know how Mattermost searches for its translation files, but in my understanding the files are there (again, it doesn’t matter if I change the owner of the files):

$ ls -alh /opt/gitlab/embedded/service/mattermost/i18n
total 2.1M
drwxr-xr-x 2 root root 4.0K Nov 28 19:45 .
drwxrwxr-x 7 root root 4.0K Nov 28 19:45 ..
-rw-r--r-- 1 root root 187K Nov 28 17:22 de.json
-rw-r--r-- 1 root root 174K Nov 28 17:22 en.json
-rw-r--r-- 1 root root 190K Nov 28 17:22 es.json
-rw-r--r-- 1 root root 193K Nov 28 17:22 fr.json
-rw-r--r-- 1 root root 207K Nov 28 17:22 ja.json
-rw-r--r-- 1 root root 184K Nov 28 17:22 ko.json
-rw-r--r-- 1 root root 184K Nov 28 17:22 nl.json
-rw-r--r-- 1 root root 185K Nov 28 17:22 pt-BR.json
-rw-r--r-- 1 root root 236K Nov 28 17:22 ru.json
-rw-r--r-- 1 root root 166K Nov 28 17:22 zh_CN.json
-rw-r--r-- 1 root root 168K Nov 28 17:22 zh_TW.json

I’ve looked at the following issues, but they relate to much older versions of Mattermost and none of them brought up a solution that worked in this case:

Steps to reproduce

  1. install most recent GitLab Omnibus (8.14.1) on Ubuntu 14.04.5 LTS
  2. fire the CLI with the path to the config file: sudo -u mattermost /opt/gitlab/embedded/bin/mattermost -config=/var/opt/gitlab/mattermost/config.json -help

EDIT: I forgot to mention, there are no log entries to this error. But just a few moments ago I’ve found a workaround in [SOLVED] How to authenticate bots using the API - #2 by jurgenhaas - Troubleshooting - Mattermost Discussion Forums

I’ve had that problem before as well and for some reason you have to cd /opt/gitlab/embedded/service/mattermost/i18n and run your commands from there. Then it works. Just tried again and can confirm that this is still the case.

Yes, thank you very much, @jurgenhaas! Moments after my post I’ve found your suggestion in [SOLVED] How to authenticate bots using the API (I couldn’t post the link in my edited post). That worked for me, too! :thumbsup:

Hey @freecastle, thanks for reporting this, and thanks @jurgenhaas for the workaround. We recently did some work with the CLI that should fix this in the 3.6 release. We created a ticket just to make sure we test it, though!

Yang

Thanks @freecastle @jurgenhaas, we’ve also submitted a pull request that resolves the issue.

It’ll be available in Mattermost 3.6, which will be released January 16th