nikivdev/code · error

No lifecycle up task found. Define task 'up' or 'dev', or se

Error message

No lifecycle up task found. Define task 'up' or 'dev', or set [lifecycle].up_task in {}

What it means

run_up looks for the project's 'up' lifecycle action: an explicit [lifecycle].up_task, or a task named 'up' or 'dev' in flow.toml. If none of these exist, it bails telling the developer where the config lives and what to define. It is a config-completeness check, not a task execution failure.

Source

Thrown at src/lifecycle.rs:43

                eprintln!(
                    "WARN lifecycle domains unavailable; continuing without localhost routing"
                );
                eprintln!("WARN {}", err);
                None
            }
        }
    } else {
        None
    };
    let _preferred_url_guard = ScopedPreferredUrl::set(preferred_url);

    let ran_task = match lifecycle.up_task.as_deref() {
        Some(task) => run_required_task(&project.flow_path, task, opts.args)?,
        None => run_optional_task_chain(&project.flow_path, &["up", "dev"], opts.args)?,
    };

    if !ran_task {
        bail!(
            "No lifecycle up task found. Define task 'up' or 'dev', or set [lifecycle].up_task in {}",
            project.flow_path.display()
        );
    }

    Ok(())
}

pub fn run_down(opts: LifecycleRunOpts) -> Result<()> {
    let project = resolve_project_config(&opts.config)?;
    let lifecycle = project.config.lifecycle.clone().unwrap_or_default();

    let mut task_ran = match lifecycle.down_task.as_deref() {
        Some(task) => run_required_task(&project.flow_path, task, opts.args.clone())?,
        None => run_optional_task_chain(&project.flow_path, &["down"], opts.args.clone())?,
    };

    if !task_ran && lifecycle.down_task.is_none() {

View on GitHub (pinned to a747e741ae)

Solutions

  1. Add an `up` (or `dev`) task to flow.toml under [tasks]
  2. Or set an explicit task in flow.toml: [lifecycle] up_task = "start"
  3. Confirm the correct flow.toml is being resolved (the path in the message) and that the task names match

Example fix

// before (flow.toml)
[tasks]
start = "docker compose up -d"
// after
[tasks]
start = "docker compose up -d"
[lifecycle]
up_task = "start"
Defensive patterns

Strategy: validation

Validate before calling

let cfg = std::fs::read_to_string("flow.toml")?;
let has_up = cfg.contains("[lifecycle]") && cfg.contains("up_task")
    || cfg.lines().any(|l| l.starts_with("up ") || l.starts_with("dev "));
if !has_up { eprintln!("flow.toml defines no up/dev task or up_task"); }

Try / catch

if let Err(e) = run_up(&project, opts) {
    if e.to_string().contains("No lifecycle up task found") {
        eprintln!("Add an 'up' or 'dev' task, or [lifecycle].up_task, to flow.toml");
    }
    return Err(e);
}

Prevention

When it happens

Trigger: Running the up lifecycle command against a project whose flow.toml has no [lifecycle].up_task setting and defines neither an 'up' nor a 'dev' task.

Common situations: New project with a minimal flow.toml lacking lifecycle tasks; task renamed (e.g. 'start' instead of 'up'/'dev') without setting up_task; running up in the wrong directory so the wrong/default flow.toml is picked up.

Related errors


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