Vim: E484: Can’t open file /tmp/vGleC01/14

Sometimes, it’s a hell to debug Vim errors — like the one in the title. It brought lots of people in trouble and finally be lucky to ‘solve’ in one unknown solution. This article is try to clarify the background reason of this error.

Vim — E484: Can’t open file /tmp/vGleC01/14

system()

Till now, the error “E484: Can’t open file /tmp/vGleC01/14” only appeared when the function system({expr} [, {input}]) is called in some vim script.

By checking the document, I noticed that finally how the command passed to system() is executed: it’s constructed using below options:

'shell' 'shellcmdflag' 'shellxquote' {expr} 'shellredir' '{tmp}' 'shellxquote'

And {tmp} is automatically generated — probably by the function tempname(). If you run the command :let tmpfile = tempname() | echo tmpfile , you will see something like /tmp/vMdIlcb/10 or similar. It’s one kind of random string which represents one non-existing file. Further, the result of tempname() tempfile will be in a private directory for Unix/Linux and it could be one of $TMPDIR, /tmp, current-dir, $HOME in order. (Thus, the error E484 normally has no relation to the environment variable $TMPDIR)

Further, the document also mentioned that “any wrong value in the options mentioned above may make the function fail.” — However, it doesn’t tell what failure could be, which cost people lots of time to troubleshoot, even by Google.

Reproduce the error

With above knowledge, it becomes easy to reproduce the problem. For example, if I have below option in .vimrc :

shcf="-c"

Then, when I run below command, it will fail with error:

:let v = system('git --version')
E484: Can't open file /tmp/verU5Ko/3

The reason is that the value of option shcf is not valid— but vim doesn’t tell that (at least in version 8.2.0834).

The correct value should be like: (when shell if /bin/tcsh)

shcf=-c

Or

shcf=-f\ -c

📓 Note:

  • There is no quote characters around value.
  • The value of the shellcmdflag or shcf must be valid for shell option — this need extra effort to check the help document of the shell used — as different shell might accept different options/flags.

If you want, you can try other ways to reproduce the problem by configuring wrong option mentioned above in .vimrc file

Solve it

After understanding the root cause, it’s much easier to solve it — just check and fix the options used by system() function. Probably, you need to check all of the options one by one, and then to see if there is any duplicated configuration values.

For example, you can configure shell flags directly in shell and then you might configure the shell flags by shcf also, which will result in error:

set shell=/bin/tcsh\ -f\ -c

Note: here, -c is not necessary because the default value of shcf is just -c , so that will result in duplicated flag and cause error. Thus, you have to remove -c from shell flag or reset shcf as empty:

set shcf=

If it still doesn’t work, continue tuning … E.g. remove some flags from shell and try again.

Finally, in general, if we don’t have knowledge of the error, the workable way is to use old version of .vimrc file and then compare difference to find which changes caused the problem — this way is applicable for any error in fact.

The key point is that you have version control for your .vimrc file. 😄

That’s all about “E484: Can’t open file /tmp/vGleC01/14” and hope can help you out of the trouble.

Thanks for your reading and happy coding!

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store