nikivdev/code · error

Active project '{}' not found. Use `f projects` to see regis

Error message

Active project '{}' not found. Use `f projects` to see registered projects.

What it means

When no --project flag and no flow.toml in the current directory are present, show_task_logs falls back to the stored active project. If that active project name no longer resolves to a registered entry (stale pointer), the command bails with this message. It is a stale-state error, not a bad user argument.

Source

Thrown at src/processes.rs:320

                );
            }
        }
    } else if opts.config.exists() {
        // flow.toml in current directory
        let (cfg_path, cfg) = tasks::load_project_config(opts.config.clone())?;
        let canonical = cfg_path.canonicalize().unwrap_or_else(|_| cfg_path.clone());
        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() {

View on GitHub (pinned to a747e741ae)

Solutions

  1. Run `f projects` to see what is registered and re-set/choose a valid project.
  2. Set a new active project: run a task in the intended project or use the projects activate command.
  3. Use `f logs -p <registered-project>` explicitly to bypass the stale active pointer.
Defensive patterns

Strategy: fallback

Validate before calling

// confirm the active pointer is still valid before relying on it
if let Some(active) = get_active_project() {
    if resolve_project(&active)?.is_none() {
        eprintln!("active project '{active}' is stale; set a new one");
    }
}

Try / catch

match show_task_logs(opts) {
    Ok(()) => (),
    Err(e) if e.to_string().contains("Active project") => {
        // recover: run inside the project dir or pass -p explicitly
        eprintln!("{e}");
        std::process::exit(1);
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: `f logs` run outside any project directory where projects::get_active_project() returns a name but resolve_project(name) returns None — e.g. the active project was unregistered, its entry deleted, or the registry reset.

Common situations: Deleting or moving the project directory without updating the active pointer, cleaning the projects registry while the active reference remained, switching machines or profiles.

Related errors


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