{"record":{"id":"d1d750577347238f","repo":"nikivdev/code","slug":"no-tasks-specified","errorCode":null,"errorMessage":"No tasks specified","messagePattern":"No tasks specified","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/parallel.rs","lineNumber":429,"sourceCode":"            }\n        }\n\n        // Show cursor\n        print!(\"{}\", SHOW_CURSOR);\n        let _ = io::stdout().flush();\n\n        self.first_failure_code.lock().await.unwrap_or(0)\n    }\n}\n\n/// Run tasks in parallel with pretty output.\npub async fn run_parallel(\n    tasks: Vec<(&str, &str)>,\n    max_jobs: usize,\n    fail_fast: bool,\n) -> Result<()> {\n    if tasks.is_empty() {\n        bail!(\"No tasks specified\");\n    }\n\n    let tasks: Vec<Task> = tasks\n        .into_iter()\n        .map(|(label, cmd)| Task::new(label, cmd))\n        .collect();\n\n    let runner = Arc::new(ParallelRunner::new(tasks, max_jobs, fail_fast));\n    let exit_code = runner.run().await;\n\n    if exit_code != 0 {\n        std::process::exit(exit_code);\n    }\n\n    Ok(())\n}\n\n/// CLI entry point for `f parallel`.","sourceCodeStart":411,"sourceCodeEnd":447,"githubUrl":"https://github.com/nikivdev/code/blob/a747e741ae92c09071d0ae946ab48488adcff1ce/src/parallel.rs#L411-L447","documentation":"run_parallel is the library-level parallel executor; it rejects an empty task vector up front. It mirrors the CLI guard in run but applies to direct programmatic callers.","triggerScenarios":"Calling run_parallel(vec![], max_jobs, fail_fast) — e.g. a caller that built its task list from an empty filter result.","commonSituations":"Programmatic use where the caller passes user input through without checking it produced at least one (label, command) pair.","solutions":["Ensure the tasks vector has at least one entry before calling run_parallel.","If callers may produce empty lists, check tasks.is_empty() first and skip/short-circuit gracefully."],"exampleFix":"// before\nrun_parallel(&[], 4, false).await?;\n\n// after\nlet tasks = build_tasks();\nif !tasks.is_empty() {\n    run_parallel(&tasks, 4, false).await?;\n}","handlingStrategy":"validation","validationCode":"if tasks.is_empty() {\n    eprintln!(\"nothing to run; skipping run_parallel\");\n    return Ok(());\n}\nrun_parallel(&tasks, max_jobs, fail_fast).await?;","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Check task lists built from user input/filters for emptiness before executing.","Make run_parallel callers responsible for the empty case at the call site.","Log when a task builder yields zero tasks so silent no-ops are visible."],"tags":["parallel","validation","api"],"backgroundTag":"empty-input-validation","analyzedSha":"a747e741ae92c09071d0ae946ab48488adcff1ce","analyzedAt":"2026-09-01T22:43:55.719Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}