GitoxideLabs/gitoxide · error

Cannot run without any task to perform on the repositories

Error message

Cannot run without any task to perform on the repositories

What it means

gitoxide-core's corpus `run` engine bails out when the resolved task list is empty. Tasks are looked up via `tasks_or_insert(&allowed_task_names)`; if no task names were supplied (or none matched) there is nothing to execute, so the function refuses to run rather than silently performing a no-op run that would still mutate corpus metadata.

Solutions

  1. Pass one or more valid task names in `allowed_task_names` (e.g. `gix corpus run <path> <task>...`).
  2. Check the spelling of the task name against tasks already registered in the corpus (query the corpus SQLite DB or list tasks).
  3. If scripting, ensure the task-name variable is non-empty before invoking run.
  4. Insert the desired tasks into the corpus first (`gix corpus insert` workflow) if none exist.

Example fix

// before
corpus::Engine::at(db_path)?.run(corpus_path, threads, dry_run, repo_sql_suffix, vec![])?;
// after
corpus::Engine::at(db_path)?.run(corpus_path, threads, dry_run, repo_sql_suffix, vec!["leak-check".into()])?;
Defensive patterns

Strategy: validation

Validate before calling

if allowed_task_names.is_empty() {
    eprintln!("no tasks given: pass at least one task name, e.g. 'leak-check'");
    std::process::exit(2);
}

Try / catch

match engine.run(...) {
    Err(e) if e.to_string().contains("without any task") => eprintln!("specify at least one task name"),
    other => other?,
}

Prevention

When it happens

Trigger: Calling `gitoxide_core::corpus::Engine::run` (or the CLI `gix corpus run`) with an empty `allowed_task_names` vec, or with task names that match no existing tasks in the corpus database, so `tasks_or_insert` returns an empty set.

Common situations: Typing a misspelled task name on the CLI, forgetting the task-name argument entirely, scripting `gix corpus run` with a variable that expands to an empty string, or a fresh corpus where no tasks have been inserted yet.

Understand the failure class

Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.

Related errors


AI-assisted analysis of GitoxideLabs/gitoxide@e73179060b (2026-09-08). Data as JSON: /api/errors/2f8b888c6a6854ab. Report an issue: GitHub.

Appendix: source

Thrown at gitoxide-core/src/corpus/engine.rs:46

impl Engine {
    /// Open the corpus DB or create it.
    pub fn open_or_create(db: PathBuf, state: State) -> anyhow::Result<Engine> {
        let con = crate::corpus::db::create(db).context("Could not open or create database")?;
        Ok(Engine { con, state })
    }

    /// Run on the existing set of repositories we have already seen or obtain them from `path` if there is none yet.
    pub fn run(
        &mut self,
        corpus_path: PathBuf,
        threads: Option<usize>,
        dry_run: bool,
        repo_sql_suffix: Option<String>,
        allowed_task_names: Vec<String>,
    ) -> anyhow::Result<()> {
        let tasks = self.tasks_or_insert(&allowed_task_names)?;
        if tasks.is_empty() {
            bail!("Cannot run without any task to perform on the repositories");
        }
        let (corpus_path, corpus_id) = self.prepare_corpus_path(corpus_path)?;
        let gitoxide_id = self.gitoxide_version_id_or_insert()?;
        let runner_id = self.runner_id_or_insert()?;
        let repos = self.find_repos_or_insert(&corpus_path, corpus_id, repo_sql_suffix)?;
        self.perform_run(&corpus_path, gitoxide_id, runner_id, &tasks, repos, threads, dry_run)
    }

    pub fn refresh(&mut self, corpus_path: PathBuf) -> anyhow::Result<()> {
        let (corpus_path, corpus_id) = self.prepare_corpus_path(corpus_path)?;
        let repos = self.refresh_repos(&corpus_path, corpus_id)?;
        self.state.progress.set_name("refresh repos".into());
        self.state.progress.info(format!(
            "Added or updated {} repositories under '{corpus_path}'",
            repos.len(),
            corpus_path = corpus_path.display(),
        ));
        Ok(())

View on GitHub (pinned to e73179060b)