nikivdev/code · warning

No running process found for task '{}'

Error message

No running process found for task '{}'

What it means

kill_by_task looks up the project's registered running processes and filters by task name; if no registered process matches the given task, it bails. This means the task exists in config perhaps but is not currently running (or its registration was lost).

Source

Thrown at src/processes.rs:140

    // Find the process entry to get its PGID
    let entry = processes.projects.values().flatten().find(|p| p.pid == pid);

    let pgid = entry.map(|e| e.pgid).unwrap_or(pid);
    let task_name = entry.map(|e| e.task_name.as_str()).unwrap_or("unknown");

    terminate_process_group(pgid, force, timeout)?;
    running::unregister_process(pid)?;

    println!("Killed {} (pid: {}, pgid: {})", task_name, pid, pgid);
    Ok(())
}

fn kill_by_task(config_path: &Path, task: &str, force: bool, timeout: u64) -> Result<()> {
    let processes = running::get_project_processes(config_path)?;
    let matching: Vec<_> = processes.iter().filter(|p| p.task_name == task).collect();

    if matching.is_empty() {
        bail!("No running process found for task '{}'", task);
    }

    for proc in matching {
        terminate_process_group(proc.pgid, force, timeout)?;
        running::unregister_process(proc.pid)?;
        println!("Killed {} (pid: {})", proc.task_name, proc.pid);
    }

    Ok(())
}

fn kill_all_for_project(config_path: &Path, force: bool, timeout: u64) -> Result<()> {
    let processes = running::get_project_processes(config_path)?;

    if processes.is_empty() {
        println!("No running processes to kill.");
        return Ok(());
    }

View on GitHub (pinned to a747e741ae)

Solutions

  1. Run `f ps` (or list running processes) to see which task names are actually running.
  2. Fix the task-name spelling to match the running task exactly.
  3. If the task should be running, start it first (e.g. `f run <task>`), then kill it.
  4. Verify you are in the correct project root (flow.toml) so the right process registry is consulted.
Defensive patterns

Strategy: validation

Validate before calling

// verify the task is running before killing
let running = list_running_processes()?;
if !running.iter().any(|p| p.task_name == task) {
    eprintln!("task '{task}' is not running; nothing to kill");
    return Ok(());
}

Try / catch

if let Err(e) = kill_processes(opts) {
    let msg = e.to_string();
    if msg.contains("No running process found") {
        eprintln!("{msg} — check `f ps` for exact task names");
    } else { return Err(e); }
}

Prevention

When it happens

Trigger: Calling `f kill <task>` (or kill_by_task) where running::get_project_processes returns no entry whose task_name equals the argument — task never started, already exited, or was killed previously.

Common situations: Typo in the task name vs flow.toml, task already finished or crashed and was unregistered, running `f kill` from a different project root so the running-process registry belongs to another project.

Related errors


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