{"record":{"id":"be10ec55caea2934","repo":"nikivdev/code","slug":"lifecycle-task-not-found","errorCode":null,"errorMessage":"lifecycle task '{}' not found","messagePattern":"lifecycle task '(.+?)' not found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/lifecycle.rs","lineNumber":92,"sourceCode":"    if let Some(domains_cfg) = lifecycle.domains.as_ref() {\n        domain_action_ran = run_domains_down(domains_cfg)?;\n    }\n\n    if !task_ran && !domain_action_ran {\n        bail!(\n            \"No lifecycle down action found. Define task 'down', set [lifecycle].down_task, or enable [lifecycle.domains] cleanup in {}\",\n            project.flow_path.display()\n        );\n    }\n\n    Ok(())\n}\n\nfn run_required_task(config_path: &Path, task_name: &str, args: Vec<String>) -> Result<bool> {\n    match run_task(config_path, task_name, args) {\n        Ok(()) => Ok(true),\n        Err(err) if is_task_not_found(&err) => {\n            bail!(\"lifecycle task '{}' not found\", task_name);\n        }\n        Err(err) => Err(err),\n    }\n}\n\nfn run_optional_task_chain(\n    config_path: &Path,\n    candidates: &[&str],\n    args: Vec<String>,\n) -> Result<bool> {\n    for name in candidates {\n        match run_task(config_path, name, args.clone()) {\n            Ok(()) => return Ok(true),\n            Err(err) if is_task_not_found(&err) => continue,\n            Err(err) => return Err(err),\n        }\n    }\n    Ok(false)","sourceCodeStart":74,"sourceCodeEnd":110,"githubUrl":"https://github.com/nikivdev/code/blob/a747e741ae92c09071d0ae946ab48488adcff1ce/src/lifecycle.rs#L74-L110","documentation":"run_required_task wraps run_task for tasks that must exist (the configured up/down task). When run_task fails specifically because the task name is not in the config (detected via is_task_not_found), it re-raises a clearer 'lifecycle task not found' error; other errors pass through unchanged.","triggerScenarios":"[lifecycle].up_task or down_task names a task that is absent from flow.toml's task definitions — e.g. up_task = \"start\" but only an 'up' task is defined.","commonSituations":"Typo in the up_task/down_task value; task deleted or renamed in flow.toml while [lifecycle] still references the old name; copying a lifecycle block between projects with different task names.","solutions":["Make the task name in [lifecycle].up_task/down_task match an existing [tasks] entry in the same flow.toml","Add the missing task definition under [tasks]","Search flow.toml for the task name from the error and reconcile spellings"],"exampleFix":"// before (flow.toml)\n[lifecycle]\nup_task = \"strt\"\n// after\n[lifecycle]\nup_task = \"start\"","handlingStrategy":"validation","validationCode":"let cfg = std::fs::read_to_string(\"flow.toml\")?;\nfor task in [\"up\", \"dev\", \"down\"] {\n    if cfg.contains(&format!(\"{} =\", task)) { println!(\"task {} defined\", task); }\n}\n// confirm any up_task/down_task value appears as a [tasks] key before running","typeGuard":null,"tryCatchPattern":"match run_required_task(&path, \"start\", args) {\n    Ok(true) => {},\n    Err(e) if e.to_string().contains(\"lifecycle task 'start' not found\") => {\n        eprintln!(\"Rename the task in [lifecycle] or add a 'start' task to [tasks]\");\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Grep flow.toml to confirm every up_task/down_task name exists under [tasks]","Rename tasks atomically: update both the [tasks] key and [lifecycle] reference in one commit","Use shared project templates so lifecycle names stay consistent"],"tags":["config","lifecycle","missing-task"],"backgroundTag":"missing-config-task","analyzedSha":"a747e741ae92c09071d0ae946ab48488adcff1ce","analyzedAt":"2026-09-01T22:43:55.719Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}