Prerequisites
Neovim Version
0.11.6
Operating system/version
MacOS 25.3.0
Actual behavior
Running :Rest last after executing a request always fails with a "request failed" notification. The error log shows:
ERROR | ... | lua/rest-nvim/request.lua:66 | request failed
Expected behavior
:Rest last should re-run the last executed HTTP request successfully, the same way :Rest run works.
Steps to reproduce
- Open any
.http file
- Run a request with
:Rest run
- Run
:Rest last
- Observe the "request failed" notification and the error in
:Rest logs
Root cause
This is a regression introduced in #535 (98f0bfc — "fix: prevent buffer change while parsing"), which moved nio.run() from inside run_request() to inside M.run(). However, M.run_last() was not updated to match.
run_request() calls .wait on a nio.control.Future, which requires being called inside a nio coroutine. After the refactor, M.run() correctly wraps the call in nio.run(), but M.run_last() still calls run_request() directly outside a coroutine:
-- M.run() — correctly wrapped
function M.run(name)
nio.run(function()
local req = parser.parse(...)
run_request(req) -- called inside nio coroutine ✓
end)
end
-- M.run_last() — NOT wrapped, causes error
function M.run_last()
local req = rest_nvim_last_request
...
run_request(req) -- called outside nio coroutine ✗
end
Fix: wrap run_request(req) in nio.run() inside M.run_last():
function M.run_last()
local req = rest_nvim_last_request
if not req then
vim.notify("No last request found", vim.log.levels.WARN, { title = "rest.nvim" })
return false
end
nio.run(function()
run_request(req)
end)
end
Minimal config for repro (using lazy.nvim)
vim.env.LAZY_STDPATH = ".repro"
load(vim.fn.system("curl -s https://raw.githubusercontent.com/folke/lazy.nvim/main/bootstrap.lua"))()
require("lazy.minit").repro({
spec = {
"rest-nvim/rest.nvim",
{
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
main = "nvim-treesitter.configs",
opts = {
ensure_installed = { "http" },
sync_install = false,
highlight = { enable = true },
indent = { enable = true },
},
},
},
})
Then open a .http file, run :Rest run, then :Rest last.
Other information
- Regression introduced in commit
98f0bfc (released in v3.11.2)
:Rest run works correctly; only :Rest last is affected
Prerequisites
Neovim Version
0.11.6
Operating system/version
MacOS 25.3.0
Actual behavior
Running
:Rest lastafter executing a request always fails with a "request failed" notification. The error log shows:Expected behavior
:Rest lastshould re-run the last executed HTTP request successfully, the same way:Rest runworks.Steps to reproduce
.httpfile:Rest run:Rest last:Rest logsRoot cause
This is a regression introduced in #535 (
98f0bfc— "fix: prevent buffer change while parsing"), which movednio.run()from insiderun_request()to insideM.run(). However,M.run_last()was not updated to match.run_request()calls.waiton anio.control.Future, which requires being called inside a nio coroutine. After the refactor,M.run()correctly wraps the call innio.run(), butM.run_last()still callsrun_request()directly outside a coroutine:Fix: wrap
run_request(req)innio.run()insideM.run_last():Minimal config for repro (using
lazy.nvim)Then open a
.httpfile, run:Rest run, then:Rest last.Other information
98f0bfc(released in v3.11.2):Rest runworks correctly; only:Rest lastis affected