I'm running into a bothersome issue I can't seem to solve myself. When I open gvim I receive the error E285: Failed to create input context

The error always comes twice, and looks to be related to XIM input. Although this is the first I've ever heard of IM and XIM as I am only ever working in English.
I don't normally use gvim but I recently started using qutebrowser and when I try to use gvim for input fields the errors pop up in a gui, and require more action from me until I can actually type into the buffer.

Basic Specs:

uname -a
Linux pop-os 5.4.0-7634-generic #38~1592497129~20.04~9a1ea2e-Ubuntu SMP Fri Jun 19 22:43:37 UTC  x86_64 x86_64 x86_64 GNU/Linux
VIM - Vi IMproved 8.1 (2018 May 18, compiled Apr 15 2020 06:40:31) Huge version
with X11-Athena GUI. +X11, +xim, +xfontset.

What I've tried:

  1. Running gvim with --clean or like gvim -u NONE -U NONE -N -i NONE file.txt. I was hoping to narrow down if a certain config somewhere was causing the issue, but the errors prevailed even when specifying this clean startup.
  2. Variations of the flags above, i.e. using my vimrc, taking some flags out etc.
  3. Running sudo gvim file.txt. This is the only way I've been able to open gvim without the errors. Unfortunately not a valid solution as I would like to run with my configs and running with -u\-U $HOME/.vimrc gives way more errors from plugins and personal scripts as my home directory is now /root/. last problem is I'm not wanting to type my password every time.
  4. Trying to set the guifont when has("gui_running") and has("x11") are true. Plus some other variants but this is the most direct logic path I could get to 'work'. However, this was a bug of it's own for me because even though I could set the guifont, and gvim could echo it back to me, the font, it's size, and other aspects would not actually change. It also never subdued the error messages in question. example of setting guifont: set guifont=-*-courier-medium-r-*-*-11-*-*-*-*-*-*-*. I tried multiple styles of setting it but to no avail, so bonus points if someone konws how to fix this because I would like to change those settings.
  5. Using the -f file.txt as suggested for some other bugs, but has no effect on the error messages.

Final Thoughts: I'm at a loss for new solutions as searches for the error only results in a few similar issues from 2014 or older, that haven't fixed my problem. And since even the --clean startups were unsuccessful I can't even drill down a certain config causing it, but using sudo actually works, but I am unable to say why.

The one solution I haven't tried is the last post on the following link, to get the source code and disable xim, but the instructions were just vague enough I wasn't sure how to do it myself. https://www.linuxquestions.org/questions/linux-software-2/gvim-complains-that-it-failed-to-create-input-context-926593/

  • Welcome to Vi and Vim!
    – D. Ben Knoble
    Jul 21, 2020 at 12:14
  • Hello, could you solve this problem? I have the same situation after upgrading to ubuntu 20 tls, thanks ...
    – iqmaker
    Feb 16, 2021 at 19:18

1 Answer 1


Same problem, after upgrade Ubuntu (20.04 TLS) worked for me:

sudo apt-get remove vim-athena vim-gui-common vim-gtk3
sudo apt-get install vim-gtk3

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.