{"record":{"id":"9ecf18acba0bf8a3","repo":"sxyazi/yazi","slug":"invalid-opt-in-processopenform","errorCode":null,"errorMessage":"Invalid 'opt' in ProcessOpenForm","messagePattern":"Invalid 'opt' in ProcessOpenForm","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"yazi-parser/src/tasks/process_open.rs","lineNumber":17,"sourceCode":"use anyhow::anyhow;\nuse mlua::{ExternalError, FromLua, IntoLua, Lua, Value};\nuse yazi_scheduler::process::ShellOpt;\nuse yazi_shared::event::{ActionCow, Replier};\n\n#[derive(Clone, Debug)]\npub struct ProcessOpenForm {\n\tpub opt:     ShellOpt,\n\tpub replier: Option<Replier>,\n}\n\nimpl TryFrom<ActionCow> for ProcessOpenForm {\n\ttype Error = anyhow::Error;\n\n\tfn try_from(mut a: ActionCow) -> Result<Self, Self::Error> {\n\t\tOk(Self {\n\t\t\topt:     a.take_any(\"opt\").ok_or_else(|| anyhow!(\"Invalid 'opt' in ProcessOpenForm\"))?,\n\t\t\treplier: a.take_replier(),\n\t\t})\n\t}\n}\n\nimpl FromLua for ProcessOpenForm {\n\tfn from_lua(_: Value, _: &Lua) -> mlua::Result<Self> { Err(\"unsupported\".into_lua_err()) }\n}\n\nimpl IntoLua for ProcessOpenForm {\n\tfn into_lua(self, _: &Lua) -> mlua::Result<Value> { Err(\"unsupported\".into_lua_err()) }\n}\n","sourceCodeStart":1,"sourceCodeEnd":30,"githubUrl":"https://github.com/sxyazi/yazi/blob/5f901b886b14de1f17460b6e52e9de5d67f8aba9/yazi-parser/src/tasks/process_open.rs#L1-L30","documentation":"ProcessOpenForm starts processing an opened file's data and requires an 'opt' payload (the process-open options, including how to reply). Its TryFrom<ActionCow> raises \"Invalid 'opt' in ProcessOpenForm\" when a.take_any(\"opt\") returns None. The replier is taken separately and optional; only 'opt' is mandatory.","triggerScenarios":"Dispatching tasks.process-open without an 'opt' field, or with an 'opt' value whose type cannot be taken as the expected ProcessOpenOpt.","commonSituations":"Custom plugin/emitter code building process-open manually; a yazi update changing the options struct so stored values no longer type-match; payload lost when relaying the action.","solutions":["Attach the ProcessOpenOpt payload under key 'opt' when constructing the action.","Check the Opt struct in yazi-parser/src/tasks/process_open.rs for your version and align types.","Route process-open through the tasks subsystem's normal open flow so 'opt' is attached automatically.","Update any out-of-tree emitters after upgrading yazi."],"exampleFix":"// before\nlet a = ActionCow::from(\"tasks.process-open\"); // missing opt\n// after\nlet a = ActionCow::from((\"tasks.process-open\", ProcessOpenOpt::default()));","handlingStrategy":"validation","validationCode":"if !action.has(\"opt\") {\n    anyhow::bail!(\"tasks.process-open requires ProcessOpenOpt under 'opt'\");\n}\nlet form = ProcessOpenForm::try_from(action)?;","typeGuard":"fn has_opt(a: &ActionCow) -> bool { a.has(\"opt\") }","tryCatchPattern":"let form = ProcessOpenForm::try_from(action)\n    .context(\"process-open dispatched without 'opt'\")?;","preventionTips":["Use the tasks open flow to generate process-open instead of hand-building it.","Attach ProcessOpenOpt explicitly when testing task processing directly.","Remember 'replier' is optional; only 'opt' is required."],"tags":["rust","action-parsing","missing-field","tasks","yazi"],"backgroundTag":"missing-required-action-field","analyzedSha":"5f901b886b14de1f17460b6e52e9de5d67f8aba9","analyzedAt":"2026-09-02T18:38:25.566Z","contentChangedAt":"2026-09-02T18:38:25.566Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}