E315 error when opening two specific files in vim

35 views
Skip to first unread message

JD Allen

unread,
Dec 27, 2022, 2:33:42 AM12/27/22
to vim_dev

It only seems to affect two specific files, and only when I open them in this particular way:

vim -p file1 file2

When I do this I get the following output:

E315: ml_get: Invalid lnum 3467
E315: ml_get: Invalid lnum 3467
E315: ml_get: Invalid lnum 3468
E315: ml_get: Invalid lnum 3469
E315: ml_get: Invalid lnum 3470

If I open file1 by itself, or file2 by itself, I get no error.

Also: if I rename one of the files and then open them with:

vim -p renamed-file1 file2

I get no error. But if I then change the name back to the original file1 and try again, i now get:

E315: ml_get: invalid lnum: 2

Finally, (excuse the convolutions) if I do the following:
-rename file1
-touch file1
-open: vim -p file1 file2 (no error)
-close vim
-delete file1
-change renamed file back to file1
-open: vim -p file1 file2

I get no error, and it would appear the problem is fixed, however after restarting the OS the original problem returns all over again.

vim version: 9.0.1046-1

environment: arch linux 


Christian Brabandt

unread,
Dec 27, 2022, 3:33:28 AM12/27/22
to vim_dev
First question: Does it occur when running `vim --clean` (e.g. with a
default set of options and no plugins involved). If yes, there is
something seriously wrong, so I assume it's some plugin going wrong
here. So what kind of plugins are you using?
Also, does your viminfo file contains references to those files?


Best,
Christian
--
Warum überquerte das Huhn die Straße?
Plato:
Für ein bedeutenderes Gut.

JD Allen

unread,
Dec 27, 2022, 7:50:54 PM12/27/22
to vim_dev
Thanks for getting back to me.

When I run it with clean: vim --clean -p file1 file2, I don't get the error. 

Does that mean its a plugin problem?

I don't know what plugins I have installed.

Yes, the files in question show up in .viminfo several times.

What should I do next?

JD

Enan Ajmain

unread,
Dec 28, 2022, 1:14:28 PM12/28/22
to vim...@googlegroups.com
On Tue, 27 Dec 2022 16:50:54 -0800 (PST)
JD Allen <androme...@gmail.com> wrote:
> When I run it with clean: vim --clean -p file1 file2, I don't get the
> error. Does that mean its a plugin problem?

Possibly. '--clean' argument tells Vim not to load your personal config
(read ':h --clean'). So if you can't reproduce the issue without
loading your personal config, that means the problem is caused by
something in your personal config. Whether it's a plugin (something
someone else wrote) or something you wrote in your vimrc, cannot be
guessed without further information. Debug your personal config [1] and
find the source of the issue.

> Yes, the files in question show up in .viminfo several times.
> What should I do next?

Read ':h viminfo'. I am not 100% sure, but it seems you opened the
files file1 and file2 sometime ago and the state of the buffers were
recorded in viminfo file the last time you quit them. And Vim is now
trying to open those files exactly how you quit them the last time,
after reading the state from viminfo file. But somehow the files have
changed in the meantime, and the lines 3467-3470 do not exist anymore,
which is causing Vim to lose its cool, because it had saved some state
information in the viminfo file -- states associated with those lines,
states which Vim can't reconcile anymore with the associated lines.

My uneducated suggestion would be to remove all lines from '~/.viminfo'
which contain mention of file1 and file2. REMEMBER to BACKUP viminfo.
^^^^^^^^^^^^^^^^^^^^^^^^^^

[1]: https://vi.stackexchange.com/questions/2003/how-do-i-debug-my-vimrc-file

--
Enan
3nan....@gmail.com
https://git.sr.ht/~enan/
https://www.github.com/3N4N

JD Allen

unread,
Jan 2, 2023, 9:45:40 PM1/2/23
to vim_dev
I did what you recommended: removed all lines from viminfo of the files in question and it seems to have worked. Have not had the error since.

Thank you!

JD Allen

unread,
Jan 4, 2023, 8:23:19 PM1/4/23
to vim_dev
Oh no, its come back again!

Deleting the names of the files from the .viminfo file worked temporarily. What does this mean? What should I do next?

Bram Moolenaar

unread,
Jan 5, 2023, 6:23:33 AM1/5/23
to vim...@googlegroups.com, JD Allen

> Oh no, its come back again!
>
> Deleting the names of the files from the .viminfo file worked temporarily.
> What does this mean? What should I do next?

When it happens again, please collect relevant information, at least:

- The lines in the .viminfo file for the two files.
- The number of lines in each file.

Be careful not to exit a Vim instance normally, it would overwrite the
.viminfo file and relevant information might change. Use "vim --clean"
to avoid that.

--
Clothes make the man. Naked people have little or no influence on society.
-- Mark Twain (Samuel Clemens) (1835-1910)

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages