sxyazi/yazi · error
invalid 'args' in SearchOpt
Error message
invalid 'args' in SearchOpt
What it means
In the same SearchOpt conversion (yazi-core/src/mgr/search.rs:31), the `args` string is split with the Unix shell splitter `yazi_shared::shell::unix::split`. If the string cannot be split (unbalanced quotes or other shell-syntax errors), the conversion bails because the search command arguments are unusable.
Source
Thrown at yazi-core/src/mgr/search.rs:31
pub args: Vec<String>,
pub r#in: Option<UrlBuf>,
}
impl_data_any!(SearchOpt);
impl TryFrom<ActionCow> for SearchOpt {
type Error = anyhow::Error;
fn try_from(mut a: ActionCow) -> Result<Self, Self::Error> {
let r#in = a.take::<UrlBuf>("in").ok();
if let Some(u) = &r#in
&& (!u.is_absolute() || u.is_search())
{
bail!("invalid 'in' in SearchOpt");
}
let Ok(args) = yazi_shared::shell::unix::split(a.str("args"), false) else {
bail!("invalid 'args' in SearchOpt");
};
Ok(Self {
via: a.str("via").parse()?,
subject: a.take_first().unwrap_or_default(),
args: args.0,
r#in,
})
}
}
// --- Via
#[derive(Clone, Copy, Debug, Deserialize, EnumString, Eq, IntoStaticStr, PartialEq)]
#[serde(rename_all = "kebab-case")]
#[strum(serialize_all = "kebab-case")]
pub enum SearchVia {
Rg,
Rga,View on GitHub (pinned to 5f901b886b)
Solutions
- Fix the quoting in the `args` string so it is valid shell syntax (balanced quotes).
- Escape dynamic values before interpolating them into args, or pass them as separate structured arguments.
- Validate the args string with the shell splitter before dispatching the action.
Example fix
// before args = "--glob '*.log" // unbalanced quote // after args = "--glob '*.log'"
Defensive patterns
Strategy: validation
Validate before calling
// reuse the same splitter the library uses, before dispatch
match yazi_shared::shell::unix::split(&args_str, false) {
Ok(_) => { /* safe to dispatch search with args */ }
Err(e) => eprintln!("bad args: {e}"),
} Prevention
- Keep quotes balanced in `args` strings in config files.
- Escape or shell-quote dynamic values (filenames with spaces/quotes) before interpolation.
- Run the args through the shell splitter in tests for every config variant.
When it happens
Trigger: Passing an `args` value containing unbalanced quotes or otherwise invalid shell syntax, e.g. `args = '"unterminated` , so `split(a.str("args"), false)` returns Err.
Common situations: Hand-edited yazi.toml search settings with a stray quote, dynamically composed args where a filename containing quotes is interpolated unescaped.
Related errors
- invalid 'in' in SearchOpt
- plugin name cannot be empty
- Invalid 'query' in FindDoOpt
- --bin-dir is only valid for the install task
- the dist task requires --target
AI-assisted analysis of sxyazi/yazi@5f901b886b (2026-09-02).
Data as JSON: /api/errors/18a2942682057f03.
Report an issue: GitHub.