{"record":{"id":"51b5fb66c43d66c4","repo":"sxyazi/yazi","slug":"err","errorCode":null,"errorMessage":"err","messagePattern":"err","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"yazi-plugin/preset/plugins/trash.lua","lineNumber":186,"sourceCode":"\tlocal url, err = absolute(Url(\"trash:///@/.\"))\n\tif url then\n\t\tya.emit(\"cd\", { url })\n\telse\n\t\tnotify(\"open\", err)\n\tend\nend\n\nfunction M:peek(job)\n\tlocal rule, mime = match(job, rt.plugin.previewers)\n\tif not rule then\n\t\treturn\n\tend\n\n\tjob.mime, job.args = mime, rule.args\n\tya.async(function()\n\t\tlocal chunk, err = ya.chunk(rule.name)\n\t\tif not chunk then\n\t\t\tya.err(err)\n\t\telseif chunk.sync_peek then\n\t\t\tya.emit(\"plugin\", { rule.name, job, method = \"peek\", scope = rt.scope() })\n\t\telse\n\t\t\tya.async_blocking(function(cx) require(cx.name):peek(cx.job) end, { name = rule.name, job = job }):wait()\n\t\tend\n\tend)\nend\n\nfunction M:seek(job)\n\tlocal rule, mime = match(job, rt.plugin.previewers)\n\tif not rule then\n\t\treturn\n\tend\n\n\tjob.mime, job.args = mime, rule.args\n\tya.emit(\"plugin\", { rule.name, job, method = \"seek\", scope = rt.scope() })\nend\n","sourceCodeStart":168,"sourceCodeEnd":204,"githubUrl":"https://github.com/sxyazi/yazi/blob/5f901b886b14de1f17460b6e52e9de5d67f8aba9/yazi-plugin/preset/plugins/trash.lua#L168-L204","documentation":"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).","triggerScenarios":"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.","commonSituations":"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.","solutions":["Check the plugin name in yazi.toml `[plugin] peekers` matches an existing plugin under the plugins dir or preset","Run `ya pack -l` / inspect the plugin file for Lua syntax errors","Run yazi with YAZI_LOG=debug to see the underlying plugin load error"],"exampleFix":"# before (yazi.toml)\n{ mime = \"image/*\", run = \"image-prevew\" }\n# after\n{ mime = \"image/*\", run = \"image-preview\" }","handlingStrategy":"validation","validationCode":"-- sanity-check plugin name before it is referenced in yazi.toml\nlocal ok, _ = pcall(require, \"image-preview\")\nif not ok then print(\"peeker plugin not found or has Lua errors\") end","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Match peeker plugin names exactly against files in the plugins dir","Lint user plugins with stylua/luacheck after edits","Test config changes with YAZI_LOG=debug"],"tags":["lua","plugin","preview","config","plugin-load"],"backgroundTag":"plugin-load-failed","analyzedSha":"5f901b886b14de1f17460b6e52e9de5d67f8aba9","analyzedAt":"2026-09-02T18:38:25.566Z","contentChangedAt":"2026-09-02T18:38:25.566Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}