{"record":{"id":"d0871a53bae71fc5","repo":"nikivdev/code","slug":"active-project-not-found-use-f-projects-to","errorCode":null,"errorMessage":"Active project '{}' not found. Use `f projects` to see registered projects.","messagePattern":"Active project '(.+?)' not found\\. Use `f projects` to see registered projects\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/processes.rs","lineNumber":320,"sourceCode":"                );\n            }\n        }\n    } else if opts.config.exists() {\n        // flow.toml in current directory\n        let (cfg_path, cfg) = tasks::load_project_config(opts.config.clone())?;\n        let canonical = cfg_path.canonicalize().unwrap_or_else(|_| cfg_path.clone());\n        let root = cfg_path\n            .parent()\n            .unwrap_or(Path::new(\".\"))\n            .canonicalize()\n            .unwrap_or_else(|_| cfg_path.parent().unwrap_or(Path::new(\".\")).to_path_buf());\n        (root, canonical, cfg.project_name)\n    } else if let Some(active) = projects::get_active_project() {\n        // Fall back to active project\n        match projects::resolve_project(&active)? {\n            Some(entry) => (entry.project_root, entry.config_path, Some(entry.name)),\n            None => {\n                bail!(\n                    \"Active project '{}' not found. Use `f projects` to see registered projects.\",\n                    active\n                );\n            }\n        }\n    } else {\n        bail!(\n            \"No flow.toml in current directory and no active project set.\\nRun a task in a project first, or use: f logs -p <project>\"\n        );\n    };\n\n    // If no task specified, try to find available logs - prefer running tasks\n    let task_name = match opts.task {\n        Some(name) => name,\n        None => {\n            let logs = get_project_log_files(&project_root, project_name.as_deref());\n\n            if logs.is_empty() {","sourceCodeStart":302,"sourceCodeEnd":338,"githubUrl":"https://github.com/nikivdev/code/blob/a747e741ae92c09071d0ae946ab48488adcff1ce/src/processes.rs#L302-L338","documentation":"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.","triggerScenarios":"`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.","commonSituations":"Deleting or moving the project directory without updating the active pointer, cleaning the projects registry while the active reference remained, switching machines or profiles.","solutions":["Run `f projects` to see what is registered and re-set/choose a valid project.","Set a new active project: run a task in the intended project or use the projects activate command.","Use `f logs -p <registered-project>` explicitly to bypass the stale active pointer."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"// confirm the active pointer is still valid before relying on it\nif let Some(active) = get_active_project() {\n    if resolve_project(&active)?.is_none() {\n        eprintln!(\"active project '{active}' is stale; set a new one\");\n    }\n}","typeGuard":null,"tryCatchPattern":"match show_task_logs(opts) {\n    Ok(()) => (),\n    Err(e) if e.to_string().contains(\"Active project\") => {\n        // recover: run inside the project dir or pass -p explicitly\n        eprintln!(\"{e}\");\n        std::process::exit(1);\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Prefer explicit `f logs -p <name>` over relying on the active pointer.","After unregistering/moving a project, re-set the active project.","Run logs from within the project directory so flow.toml wins."],"tags":["cli","stale-state","project-resolution"],"backgroundTag":"stale-active-project-reference","analyzedSha":"a747e741ae92c09071d0ae946ab48488adcff1ce","analyzedAt":"2026-09-01T22:43:55.719Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}