{"record":{"id":"c6eec4cba662ffa2","repo":"sxyazi/yazi","slug":"unknown-task","errorCode":null,"errorMessage":"unknown task: {}","messagePattern":"unknown task: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"yazi-build/src/args.rs","lineNumber":43,"sourceCode":"\t\t\t}\n\t\t}\n\n\t\tmatch task.to_str() {\n\t\t\tSome(\"build\") => {\n\t\t\t\tensure!(bin_dir.as_os_str().is_empty(), \"--bin-dir is only valid for the install task\");\n\t\t\t\tOk(Self::Build(target))\n\t\t\t}\n\t\t\tSome(\"dist\") => {\n\t\t\t\tensure!(!target.is_empty(), \"the dist task requires --target\");\n\t\t\t\tensure!(bin_dir.as_os_str().is_empty(), \"--bin-dir is only valid for the install task\");\n\t\t\t\tOk(Self::Dest(target))\n\t\t\t}\n\t\t\tSome(\"install\") => {\n\t\t\t\tensure!(target.is_empty(), \"--target is not valid for the install task\");\n\t\t\t\tOk(Self::Install(bin_dir))\n\t\t\t}\n\t\t\tSome(\"--help\") => Ok(Self::Help),\n\t\t\t_ => bail!(\"unknown task: {}\", task.display()),\n\t\t}\n\t}\n\n\tfn value(args: &mut impl Iterator<Item = OsString>, option: &str) -> Result<OsString> {\n\t\targs.next().with_context(|| format!(\"missing value for {option}\"))\n\t}\n\n\tfn target(args: &mut impl Iterator<Item = OsString>) -> Result<String> {\n\t\tSelf::value(args, \"--target\")?\n\t\t\t.into_string()\n\t\t\t.map_err(|_| anyhow!(\"--target must be valid UTF-8\"))\n\t}\n}\n","sourceCodeStart":25,"sourceCodeEnd":57,"githubUrl":"https://github.com/sxyazi/yazi/blob/5f901b886b14de1f17460b6e52e9de5d67f8aba9/yazi-build/src/args.rs#L25-L57","documentation":"After option parsing, `Args::parse` matches the first positional argument (the task) against `build`, `install`, and `--help`. Any other task name bails with `unknown task: <task>`. This enforces that the cargo subcommand is invoked with exactly one of the supported tasks.","triggerScenarios":"Running `cargo yazi deploy`, `cargo yazi Build`, `cargo yazi` with a typo like `instal`, or accidentally passing a flag-like token as the first positional.","commonSituations":"Typo in package.json / CI scripts; muscle memory from other cargo helpers (`cargo yank`, `cargo install`); outdated documentation referencing a removed task.","solutions":["Use `build` or `install` as the task: `cargo yazi build` or `cargo yazi install --bin-dir <dir>`.","Run `cargo yazi --help` to see valid tasks for your installed version.","Update any automation that references an old task name."],"exampleFix":"// before\ncargo yazi release\n// after\ncargo yazi build","handlingStrategy":"validation","validationCode":"const TASKS = [\"build\", \"install\"];\nif (!TASKS.includes(process.argv[2])) {\n  throw new Error(`unknown task: ${process.argv[2]} (valid: ${TASKS.join(\", \")})`);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass the task as the first argument: `cargo yazi build|install`.","Pin the task name in scripts/CI rather than parameterizing it from user input.","Consult `--help` after upgrading, as the task set may change."],"tags":["cli","argument-parsing","usage-error"],"backgroundTag":"unknown-cli-option","analyzedSha":"5f901b886b14de1f17460b6e52e9de5d67f8aba9","analyzedAt":"2026-09-02T18:38:25.566Z","contentChangedAt":"2026-09-02T18:38:25.566Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}