{"record":{"id":"bd67a2bd2e19c64a","repo":"nikivdev/code","slug":"no-task-name-provided","errorCode":null,"errorMessage":"no task name provided","messagePattern":"no task name provided","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/main.rs","lineNumber":639,"sourceCode":"            }\n            Some(Commands::Cli(cmd)) => {\n                external_cli::run_command(cmd)?;\n            }\n            Some(Commands::Registry(cmd)) => {\n                registry::run(cmd)?;\n            }\n            Some(Commands::Analytics(cmd)) => {\n                analytics::run(cmd)?;\n            }\n            Some(Commands::Proxy(cmd)) => {\n                proxy_command(cmd)?;\n            }\n            Some(Commands::Domains(cmd)) => {\n                domains::run(cmd)?;\n            }\n            Some(Commands::TaskShortcut(args)) => {\n                if args.is_empty() {\n                    bail!(\"no task name provided\");\n                }\n                if task_match::looks_like_cli_subcommand(&args) {\n                    let invalid = args.get(1).map(String::as_str).unwrap_or(args[0].as_str());\n                    Cli::command()\n                        .error(\n                            ErrorKind::InvalidSubcommand,\n                            format!(\"unrecognized subcommand '{invalid}'\"),\n                        )\n                        .exit();\n                }\n                run_cli_frontdoor(args)?;\n            }\n            None => {\n                palette::run(TasksOpts::default())?;\n            }\n        }\n\n        Ok(())","sourceCodeStart":621,"sourceCodeEnd":657,"githubUrl":"https://github.com/nikivdev/code/blob/a747e741ae92c09071d0ae946ab48488adcff1ce/src/main.rs#L621-L657","documentation":"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.","triggerScenarios":"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.","commonSituations":"Shell variable expansion producing empty args (`flow task \"$EMPTY_VAR\"`); a wrapper script forwarding no positional arguments.","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."],"exampleFix":"# before\nflow task \"$TASK\"   # TASK is empty -> \"no task name provided\"\n# after\n: \"${TASK:?task name required}\"\nflow task \"$TASK\"","handlingStrategy":"validation","validationCode":"#[allow(non_snake_case)]\nfn has_task_arg(args: &[String]) -> bool {\n    !args.is_empty() && !args[0].trim().is_empty()\n}\nif !has_task_arg(&args) { eprintln!(\"usage: flow <task> [args...]\"); std::process::exit(2); }","typeGuard":"fn first_arg(args: &[String]) -> Option<&str> {\n    args.first().map(|s| s.as_str()).filter(|s| !s.trim().is_empty())\n}","tryCatchPattern":"match Cli::try_parse() {\n    Err(_) => match run_shortcut(args) {\n        Err(e) if e.to_string() == \"no task name provided\" => {\n            eprintln!(\"Usage: flow <taskname> [args...]\");\n            std::process::exit(2);\n        }\n        other => other?,\n    },\n    Ok(cli) => { /* normal dispatch */ }\n}","preventionTips":["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 \"$@\"."],"tags":["cli","argument-validation","task-runner"],"backgroundTag":"missing-required-argument","analyzedSha":"a747e741ae92c09071d0ae946ab48488adcff1ce","analyzedAt":"2026-09-01T22:43:55.719Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}