nikivdev/code · error

No tasks specified

Error message

No tasks specified

What it means

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.

Solutions

  1. Ensure the tasks vector has at least one entry before calling run_parallel.
  2. If callers may produce empty lists, check tasks.is_empty() first and skip/short-circuit gracefully.

Example fix

// before
run_parallel(&[], 4, false).await?;

// after
let tasks = build_tasks();
if !tasks.is_empty() {
    run_parallel(&tasks, 4, false).await?;
}
Defensive patterns

Strategy: validation

Validate before calling

if tasks.is_empty() {
    eprintln!("nothing to run; skipping run_parallel");
    return Ok(());
}
run_parallel(&tasks, max_jobs, fail_fast).await?;

Prevention

When it happens

Trigger: Calling run_parallel(vec![], max_jobs, fail_fast) — e.g. a caller that built its task list from an empty filter result.

Common situations: Programmatic use where the caller passes user input through without checking it produced at least one (label, command) pair.

Related errors


AI-assisted analysis of nikivdev/code@a747e741ae (2026-09-01). Data as JSON: /api/errors/d1d750577347238f. Report an issue: GitHub.

Appendix: source

Thrown at src/parallel.rs:429

            }
        }

        // Show cursor
        print!("{}", SHOW_CURSOR);
        let _ = io::stdout().flush();

        self.first_failure_code.lock().await.unwrap_or(0)
    }
}

/// Run tasks in parallel with pretty output.
pub async fn run_parallel(
    tasks: Vec<(&str, &str)>,
    max_jobs: usize,
    fail_fast: bool,
) -> Result<()> {
    if tasks.is_empty() {
        bail!("No tasks specified");
    }

    let tasks: Vec<Task> = tasks
        .into_iter()
        .map(|(label, cmd)| Task::new(label, cmd))
        .collect();

    let runner = Arc::new(ParallelRunner::new(tasks, max_jobs, fail_fast));
    let exit_code = runner.run().await;

    if exit_code != 0 {
        std::process::exit(exit_code);
    }

    Ok(())
}

/// CLI entry point for `f parallel`.

View on GitHub (pinned to a747e741ae)