nikivdev/code · error

No flow.toml in current directory and no active project set.

Error message

No flow.toml in current directory and no active project set.
Run a task in a project first, or use: f logs -p <project>

What it means

This is the terminal fallback of show_task_logs' project resolution: no --project flag, no flow.toml in the current directory, and no active project set. Since there is no way to determine which project's logs to show, the tool bails with instructions on how to provide one.

Source

Thrown at src/processes.rs:327

        let root = cfg_path
            .parent()
            .unwrap_or(Path::new("."))
            .canonicalize()
            .unwrap_or_else(|_| cfg_path.parent().unwrap_or(Path::new(".")).to_path_buf());
        (root, canonical, cfg.project_name)
    } else if let Some(active) = projects::get_active_project() {
        // Fall back to active project
        match projects::resolve_project(&active)? {
            Some(entry) => (entry.project_root, entry.config_path, Some(entry.name)),
            None => {
                bail!(
                    "Active project '{}' not found. Use `f projects` to see registered projects.",
                    active
                );
            }
        }
    } else {
        bail!(
            "No flow.toml in current directory and no active project set.\nRun a task in a project first, or use: f logs -p <project>"
        );
    };

    // If no task specified, try to find available logs - prefer running tasks
    let task_name = match opts.task {
        Some(name) => name,
        None => {
            let logs = get_project_log_files(&project_root, project_name.as_deref());

            if logs.is_empty() {
                println!("No logs found for this project.");
                return Ok(());
            }

            // Check for running tasks
            let running = running::get_project_processes(&config_path).unwrap_or_default();
            let running_tasks: Vec<_> = running.iter().map(|p| p.task_name.clone()).collect();

View on GitHub (pinned to a747e741ae)

Solutions

  1. cd into the project directory containing flow.toml and re-run `f logs`.
  2. Pass a project explicitly: `f logs -p <project>`.
  3. Run any task in your project first so it registers and becomes the active project.

Example fix

// before
f logs
// after
cd /path/to/project  # contains flow.toml
f logs
# or explicitly:
f logs -p my-project
Defensive patterns

Strategy: validation

Validate before calling

if !std::path::Path::new("flow.toml").exists()
    && std::env::var("F_PROJECT").is_err()
{
    eprintln!("run from a project dir or set F_PROJECT / pass -p");
    std::process::exit(2);
}

Try / catch

match show_task_logs(opts) {
    Ok(()) => (),
    Err(e) if e.to_string().contains("No flow.toml") => {
        eprintln!("{e}");
        std::process::exit(2);
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: Running `f logs` (no -p, no task targeting context) from a directory without flow.toml on a fresh setup where projects::get_active_project() returns None.

Common situations: First-time use before any task has been run, running from $HOME or a random directory, a wiped config/registry file, or expecting logs to resolve globally instead of per project.

Related errors


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