nikivdev/code · error

No log file found for task '{}' at {}

Error message

No log file found for task '{}' at {}

What it means

After resolving the project and task, show_task_logs computes the task's log file path and bails if that file does not exist. This means no log was ever written for the task at that location — the task never ran, was run under a different project name, or logs were cleaned.

Source

Thrown at src/processes.rs:379

                return Ok(());
            } else if logs.len() == 1 {
                // No running tasks, but only one log file
                logs[0].clone()
            } else {
                // No running tasks, multiple log files
                println!("No running tasks. Available logs:");
                for log in &logs {
                    println!("  f logs {}", log);
                }
                return Ok(());
            }
        }
    };

    let log_path = get_log_path(&project_root, project_name.as_deref(), &task_name);

    if !log_path.exists() {
        bail!(
            "No log file found for task '{}' at {}",
            task_name,
            log_path.display()
        );
    }

    if opts.follow {
        tail_follow(&log_path, opts.lines, opts.quiet)?;
    } else {
        tail_lines(&log_path, opts.lines)?;
    }

    Ok(())
}

fn show_all_logs(lines: usize) -> Result<()> {
    let base = log_dir();
    if !base.exists() {

View on GitHub (pinned to a747e741ae)

Solutions

  1. Run the task first (`f run <task>`) so a log file is created, then view logs.
  2. Verify the task name spelling matches what was actually run.
  3. Check the log directory shown in the message manually (ls) to see which task logs exist.
  4. If logs were deleted or the project was renamed, re-run tasks to regenerate logs under the current project name.
Defensive patterns

Strategy: validation

Validate before calling

// check a log exists before asking to view it
let logs = std::fs::read_dir(log_dir)?;
let found = logs.filter_map(Result::ok)
    .any(|e| e.file_name().to_string_lossy().contains(task));
if !found {
    eprintln!("no log for '{task}' yet; run `f run {task}` first");
    return Ok(());
}

Try / catch

match show_task_logs(opts) {
    Ok(()) => (),
    Err(e) if e.to_string().contains("No log file found") => {
        eprintln!("{e} — run the task first");
        std::process::exit(1);
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: `f logs <task>` where get_log_path(project_root, project_name, task).exists() is false — task never started, wrong task name, logs directory cleared, or project_name changed so the path differs from where logs were written.

Common situations: Asking for logs of a configured-but-never-run task, after manually deleting the logs directory, running with -p under a different project name than when the task ran, or a task whose run failed before log file creation.

Understand the failure class

Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.

Related errors


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