nikivdev/code · error
no task name provided
Error message
no task name provided
What it means
When main dispatches a TaskShortcut (bare words not matching any CLI subcommand), it expects at least the task name; if the args vector is empty there is nothing to run, so it bails immediately. This is a CLI usage error guarding the shortcut path of the argument parser.
Source
Thrown at src/main.rs:639
}
Some(Commands::Cli(cmd)) => {
external_cli::run_command(cmd)?;
}
Some(Commands::Registry(cmd)) => {
registry::run(cmd)?;
}
Some(Commands::Analytics(cmd)) => {
analytics::run(cmd)?;
}
Some(Commands::Proxy(cmd)) => {
proxy_command(cmd)?;
}
Some(Commands::Domains(cmd)) => {
domains::run(cmd)?;
}
Some(Commands::TaskShortcut(args)) => {
if args.is_empty() {
bail!("no task name provided");
}
if task_match::looks_like_cli_subcommand(&args) {
let invalid = args.get(1).map(String::as_str).unwrap_or(args[0].as_str());
Cli::command()
.error(
ErrorKind::InvalidSubcommand,
format!("unrecognized subcommand '{invalid}'"),
)
.exit();
}
run_cli_frontdoor(args)?;
}
None => {
palette::run(TasksOpts::default())?;
}
}
Ok(())View on GitHub (pinned to a747e741ae)
Solutions
- Provide the task name: `flow <taskname> [args...]`.
- Check the shell variable actually contains a value before invoking.
- Quote/shift arguments in wrapper scripts so at least one positional arg is forwarded.
Example fix
# before
flow task "$TASK" # TASK is empty -> "no task name provided"
# after
: "${TASK:?task name required}"
flow task "$TASK" Defensive patterns
Strategy: validation
Validate before calling
#[allow(non_snake_case)]
fn has_task_arg(args: &[String]) -> bool {
!args.is_empty() && !args[0].trim().is_empty()
}
if !has_task_arg(&args) { eprintln!("usage: flow <task> [args...]"); std::process::exit(2); } Type guard
fn first_arg(args: &[String]) -> Option<&str> {
args.first().map(|s| s.as_str()).filter(|s| !s.trim().is_empty())
} Try / catch
match Cli::try_parse() {
Err(_) => match run_shortcut(args) {
Err(e) if e.to_string() == "no task name provided" => {
eprintln!("Usage: flow <taskname> [args...]");
std::process::exit(2);
}
other => other?,
},
Ok(cli) => { /* normal dispatch */ }
} Prevention
- Verify shell variables are non-empty before passing them as task args.
- Use `set -u` in shell wrappers to catch unset variables.
- Add a usage/help guard in wrapper scripts forwarding "$@".
When it happens
Trigger: Invoking the binary so that Commands::TaskShortcut matches with an empty args vec — e.g. an empty trailing argument or a script passing zero arguments after the shortcut subcommand keyword.
Common situations: Shell variable expansion producing empty args (`flow task "$EMPTY_VAR"`); a wrapper script forwarding no positional arguments.
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
- sessions requires a specific provider (claude or codex)
- continue requires a specific provider (claude or codex)
- --all cannot be combined with HASH. Use `f commit-queue appr
- --path cannot be used with --no-commit or --hash
- unknown `f pr feedback` option: {token}
AI-assisted analysis of nikivdev/code@a747e741ae (2026-09-01).
Data as JSON: /api/errors/bd67a2bd2e19c64a.
Report an issue: GitHub.