Skip to content

Rest run => Async task failed without call back: The coroutine failed #537

Closed as duplicate of#498
@uchoa

Description

@uchoa

Prerequisites

  • I am using the latest stable release of Neovim
  • I am using the latest version of the plugin
  • I can reproduce the bug with minimal config below

Neovim Version

NVIM v0.10.4 Build type: Release LuaJIT 2.1.1736781742

Operating system/version

macOS Sequoia 15.3.1

Actual behavior

When I call :Rest run on any endpoint, I get this error:

Error executing Lua callback: .../uchoa/.local/share/nvim/lazy/nvim-nio/lua/nio/tasks.lua:100: Async task failed without callback: The coroutine failed with this message:
...re/nvim/lazy/rest.nvim/lua/rest-nvim/client/curl/cli.lua:360: attempt to index field 'handle' (a nil value)
stack traceback:
        ...re/nvim/lazy/rest.nvim/lua/rest-nvim/client/curl/cli.lua: in function 'request'
        ...ocal/share/nvim/lazy/rest.nvim/lua/rest-nvim/request.lua:64: in function 'run_request'
        ...ocal/share/nvim/lazy/rest.nvim/lua/rest-nvim/request.lua:120: in function <...ocal/share/nvim/lazy/rest.nvim/lua/rest-nvim/request.lua:109>
stack traceback:
        [C]: in function 'error'
        .../uchoa/.local/share/nvim/lazy/nvim-nio/lua/nio/tasks.lua:100: in function 'close_task'
        .../uchoa/.local/share/nvim/lazy/nvim-nio/lua/nio/tasks.lua:122: in function 'step'
        .../uchoa/.local/share/nvim/lazy/nvim-nio/lua/nio/tasks.lua:150: in function 'run'
        ...ocal/share/nvim/lazy/rest.nvim/lua/rest-nvim/request.lua:109: in function 'run'
        ...cal/share/nvim/lazy/rest.nvim/lua/rest-nvim/commands.lua:124: in function 'impl'
        ...cal/share/nvim/lazy/rest.nvim/lua/rest-nvim/commands.lua:309: in function <...cal/share/nvim/lazy/rest.nvim/lua/rest-nvim/commands.lua:297>

Expected behavior

I expected the request to be executed as declared in the .http file.

Steps to reproduce

Open the .http file, place the cursor on a request and :Rest run.

curl --version:

curl 8.7.1 (x86_64-apple-darwin24.0) libcurl/8.7.1 (SecureTransport) LibreSSL/3.3.6 zlib/1.2.12 nghttp2/1.63.0
Release-Date: 2024-03-27
Protocols: dict file ftp ftps gopher gophers http https imap imaps ipfs ipns ldap ldaps mqtt pop3 pop3s rtsp smb smbs smtp smtps telnet tftp
Features: alt-svc AsynchDNS GSS-API HSTS HTTP2 HTTPS-proxy IPv6 Kerberos Largefile libz MultiSSL NTLM SPNEGO SSL threadsafe UnixSockets

luajit -v
LuaJIT 2.1.1736781742 -- Copyright (C) 2005-2025 Mike Pall. https://luajit.org/

Minimal config for repro (using lazy.nvim)

My rest.lua (lazy.nvim) is this:


return {
	"rest-nvim/rest.nvim",
	dependencies = {
		{
			"nvim-treesitter/nvim-treesitter",
			opts = function(_, opts)
				opts.ensure_installed = opts.ensure_installed or {}
				table.insert(opts.ensure_installed, "http")
			end,
		},
		{
			"vhyrro/luarocks.nvim",
			priority = 1000, -- Very high priority is required, luarocks.nvim should run as the first plugin in your config.
			config = true,
		},
	},
}


In fact I didn't have the luarocks dependency declared. Added it after the plugin started crashing.

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions