Repository navigation
bug: E19 Mark has invalid line number when ctrl-o #625
Copy link
Copy link
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Did you check the docs and existing issues?
- I have read the docs
- I have searched the existing issues
Neovim version (nvim -v)
NVIM v0.11.0 Build type: Release
Operating system/version
NixOS 25.05.20250412.2631b0b (Warbler)
Describe the bug
When navigating directories via the - key creates entries in the jump list. After visiting several directories this way, then quitting and relaunching Neovim, attempting to navigate backward using <C-o> can sometimes trigger the following error:
E19: Mark has invalid line number
This error does not occur consistently. It seems the visiting more directories before relaunching will make it more possible to encounter the error.
Observations
- Inspecting the jump list (
:jumps) after restarting Neovim shows that some entries corresponding tooil://buffers have line numbers that exceed the number of items in the respective directory—even when all hidden items are shown (the wrong line number will increase further if the hidden items are shown). - It appears that the line numbers associated with these jump entries are incorrect or become corrupted after restarting Neovim. They are fine before quiting Neovim.
Related issues
- It seems that
netrwalso have this bug. Navigating back from netrw results in "Mark has invalid line number" neovim/neovim#24721 (comment) - feature request: Add oil buffer to jumplist when opening a file #201 (comment)
What is the severity of this bug?
minor (annoyance)
Steps To Reproduce
- mkdir -p a/{b,c,d}
- nvim -u repro.lua
- "-" to go to current directories
- navigate to some directories with "enter", "-" and "jk"
- close neovim and re-open neovim
- ctrl-o to go to previous directories handled by oil
oil:///.... E19error will appear
Expected Behavior
ctrl-o till the end of the jumplist without any errors
Directory structure
.repro
repro.lua
a
a/b
a/c
a/d
Repro
-- save as repro.lua
-- run with nvim -u repro.lua
-- DO NOT change the paths
local root = vim.fn.fnamemodify("./.repro", ":p")
-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "runtime", "cache" }) do
vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end
-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"--single-branch",
"https://github.com/folke/lazy.nvim.git",
lazypath,
})
end
vim.opt.runtimepath:prepend(lazypath)
-- install plugins
local plugins = {
"folke/tokyonight.nvim",
{
"stevearc/oil.nvim",
config = function()
require("oil").setup({
-- add any needed settings here
cleanup_delay_ms = false,
keymaps = {
["="] = "actions.cd",
["`"] = false,
["<C-v>"] = "actions.select_vsplit",
["<C-s>"] = false,
["-"] = { "actions.parent", mode = "n" },
["_"] = { "actions.open_cwd", mode = "n" },
},
})
end,
},
-- add any other plugins here
}
require("lazy").setup(plugins, {
root = root .. "/plugins",
})
vim.cmd.colorscheme("tokyonight")
-- add anything else here
vim.keymap.set("n", "-", "<CMD>Oil<CR>", { desc = "Open parent directory" })Did you check the bug with a clean config?
- I have confirmed that the bug reproduces with
nvim -u repro.luausing the repro.lua file above.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working
Activity
necronyxon commentedon Feb 16, 2026
You can open Oil in a floating window and set it to fill the screen, so that it looks mostly just like a normal Oil buffer and the jumplist doesn't get tainted.
The only downside is not being able to jump to/from oil via the jumplist, but at least for me that is not a problem.
I don't know if there's a better way to do it, but here's a snippet of my config with only the relevant options: