{"record":{"id":"4f9d4790892291c4","repo":"nikivdev/code","slug":"no-log-file-found-for-task-at","errorCode":null,"errorMessage":"No log file found for task '{}' at {}","messagePattern":"No log file found for task '(.+?)' at (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/processes.rs","lineNumber":379,"sourceCode":"                return Ok(());\n            } else if logs.len() == 1 {\n                // No running tasks, but only one log file\n                logs[0].clone()\n            } else {\n                // No running tasks, multiple log files\n                println!(\"No running tasks. Available logs:\");\n                for log in &logs {\n                    println!(\"  f logs {}\", log);\n                }\n                return Ok(());\n            }\n        }\n    };\n\n    let log_path = get_log_path(&project_root, project_name.as_deref(), &task_name);\n\n    if !log_path.exists() {\n        bail!(\n            \"No log file found for task '{}' at {}\",\n            task_name,\n            log_path.display()\n        );\n    }\n\n    if opts.follow {\n        tail_follow(&log_path, opts.lines, opts.quiet)?;\n    } else {\n        tail_lines(&log_path, opts.lines)?;\n    }\n\n    Ok(())\n}\n\nfn show_all_logs(lines: usize) -> Result<()> {\n    let base = log_dir();\n    if !base.exists() {","sourceCodeStart":361,"sourceCodeEnd":397,"githubUrl":"https://github.com/nikivdev/code/blob/a747e741ae92c09071d0ae946ab48488adcff1ce/src/processes.rs#L361-L397","documentation":"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.","triggerScenarios":"`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.","commonSituations":"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.","solutions":["Run the task first (`f run <task>`) so a log file is created, then view logs.","Verify the task name spelling matches what was actually run.","Check the log directory shown in the message manually (ls) to see which task logs exist.","If logs were deleted or the project was renamed, re-run tasks to regenerate logs under the current project name."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// check a log exists before asking to view it\nlet logs = std::fs::read_dir(log_dir)?;\nlet found = logs.filter_map(Result::ok)\n    .any(|e| e.file_name().to_string_lossy().contains(task));\nif !found {\n    eprintln!(\"no log for '{task}' yet; run `f run {task}` first\");\n    return Ok(());\n}","typeGuard":null,"tryCatchPattern":"match show_task_logs(opts) {\n    Ok(()) => (),\n    Err(e) if e.to_string().contains(\"No log file found\") => {\n        eprintln!(\"{e} — run the task first\");\n        std::process::exit(1);\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Run the task before requesting its logs.","Do not delete the project's logs directory manually.","Use the same project name (-p) that was active when the task ran.","Confirm task name spelling against flow.toml."],"tags":["logs","file-not-found","cli"],"backgroundTag":"file-not-found","analyzedSha":"a747e741ae92c09071d0ae946ab48488adcff1ce","analyzedAt":"2026-09-01T22:43:55.719Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}