sxyazi/yazi · error

err

Error message

err

What it means

In trash.lua's peek machinery, ya.chunk(rule.name) runs the plugin's chunk/setup for a configured peeker rule; on failure ya.err surfaces the error. This means the plugin referenced by a `peek`/mime rule in yazi.toml failed to load or its setup rejected the call (bad plugin name, Lua load error, or plugin returning nil from chunk setup).

Source

Thrown at yazi-plugin/preset/plugins/trash.lua:186

	local url, err = absolute(Url("trash:///@/."))
	if url then
		ya.emit("cd", { url })
	else
		notify("open", err)
	end
end

function M:peek(job)
	local rule, mime = match(job, rt.plugin.previewers)
	if not rule then
		return
	end

	job.mime, job.args = mime, rule.args
	ya.async(function()
		local chunk, err = ya.chunk(rule.name)
		if not chunk then
			ya.err(err)
		elseif chunk.sync_peek then
			ya.emit("plugin", { rule.name, job, method = "peek", scope = rt.scope() })
		else
			ya.async_blocking(function(cx) require(cx.name):peek(cx.job) end, { name = rule.name, job = job }):wait()
		end
	end)
end

function M:seek(job)
	local rule, mime = match(job, rt.plugin.previewers)
	if not rule then
		return
	end

	job.mime, job.args = mime, rule.args
	ya.emit("plugin", { rule.name, job, method = "seek", scope = rt.scope() })
end

View on GitHub (pinned to 5f901b886b)

Solutions

  1. Check the plugin name in yazi.toml `[plugin] peekers` matches an existing plugin under the plugins dir or preset
  2. Run `ya pack -l` / inspect the plugin file for Lua syntax errors
  3. Run yazi with YAZI_LOG=debug to see the underlying plugin load error

Example fix

# before (yazi.toml)
{ mime = "image/*", run = "image-prevew" }
# after
{ mime = "image/*", run = "image-preview" }
Defensive patterns

Strategy: validation

Validate before calling

-- sanity-check plugin name before it is referenced in yazi.toml
local ok, _ = pcall(require, "image-preview")
if not ok then print("peeker plugin not found or has Lua errors") end

Prevention

When it happens

Trigger: A file whose mime matches a peeker rule triggers the rule's plugin, and require(rule.name) fails (plugin not found / syntax error) or ya.chunk returns nil.

Common situations: Typos in `[plugin] peekers` plugin names in yazi.toml; renamed/removed built-in plugin versions; user plugin with a Lua syntax error in ~/.config/yazi/plugins.

Related errors


AI-assisted analysis of sxyazi/yazi@5f901b886b (2026-09-02). Data as JSON: /api/errors/51b5fb66c43d66c4. Report an issue: GitHub.