sxyazi/yazi · error
argument not found: {:?}
Error message
argument not found: {:?} What it means
`Action::get` looks up a named argument in the action's argument map and tries to convert it to the requested type T. If no argument with that key exists, it bails with "argument not found: {name}" (the key is Debug-formatted). Unlike the convenience accessors `str()` and `bool()`, `get()` propagates missing keys as errors rather than defaulting.
Source
Thrown at yazi-shared/src/event/action.rs:122
}
self
}
pub fn with_replier(mut self, tx: impl Into<Replier>) -> Self {
self.args.insert("replier".into(), Data::Any(Box::new(tx.into())));
self
}
// --- Get
pub fn get<'a, T>(&'a self, name: impl Into<DataKey>) -> Result<T>
where
T: TryFrom<&'a Data>,
T::Error: Into<anyhow::Error>,
{
let name = name.into();
match self.args.get(&name) {
Some(data) => data.try_into().map_err(Into::into),
None => bail!("argument not found: {:?}", name),
}
}
pub fn str(&self, name: impl Into<DataKey>) -> &str { self.get(name).unwrap_or_default() }
pub fn bool(&self, name: impl Into<DataKey>) -> bool { self.get(name).unwrap_or(false) }
fn any<T: 'static>(&self, name: impl Into<DataKey>) -> Option<&T> {
self.args.get(&name.into())?.as_any()
}
pub fn replier(&self) -> Option<&Replier> { self.any("replier") }
pub fn first<'a, T>(&'a self) -> Result<T>
where
T: TryFrom<&'a Data>,
T::Error: Into<anyhow::Error>,
{View on GitHub (pinned to 5f901b886b)
Solutions
- Use `action.str(name)` or `action.bool(name)` if a default (""/false) is acceptable instead of `get()`.
- Check the sender (keymap config, Lua plugin call) and include the missing argument with the exact key name.
- Verify key spelling/case against the handler's expected `DataKey`.
- After version upgrades, diff the plugin's emitted args against the handler's read args — names may have changed.
Example fix
// before
let url: Url = action.get("url")?; // panics into Err if key absent
// after
let url: Option<Url> = action.args.get("url").and_then(|d| d.clone().try_into().ok());
let Some(url) = url else { anyhow::bail!("'url' argument is required") }; Defensive patterns
Strategy: validation
Validate before calling
fn has_arg(action: &Action, name: &str) -> bool {
action.args.get(name).is_some()
} Try / catch
let url: Url = match action.get("url") {
Ok(u) => u,
Err(e) => { tracing::warn!("missing/invalid 'url' arg: {e}"); return Ok(()); }
}; Prevention
- Keep sender and receiver argument key names in a shared constant or documented list.
- Prefer `str()`/`bool()` accessors when a default is acceptable.
- After upgrades, diff emitted command args vs handler reads.
- Validate keymap config entries at load time for required command arguments.
When it happens
Trigger: Calling `action.get::<T>("some_key")` where the emitting side never set "some_key" in the action's args, or the key name/key-casing differs between sender and receiver; also when the argument exists but cannot convert to T (that yields the conversion error instead).
Common situations: Yazi plugin/config keymap bindings invoking commands with missing arguments (e.g. a `spot`/`peek`/`fetch` call that omits an option the Rust handler reads); renamed or typo'd argument keys after an upgrade; Lua side passing arguments under different names than the Rust side expects.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- not a number
- command name cannot be empty
- URN cannot be longer than URI
- URI exceeds the entire URL
- URN cannot include a root directory
AI-assisted analysis of sxyazi/yazi@5f901b886b (2026-09-02).
Data as JSON: /api/errors/65fe795ed4cb9567.
Report an issue: GitHub.