nikivdev/code · error

No deployment config found in flow.toml. Add one of: [host]

Error message

No deployment config found in flow.toml.

Add one of:
[host]
dest = "/opt/myapp"
run = "./server"

[cloudflare]
path = "worker"

[railway]
project = "my-project"

Or run:
f deploy setup

What it means

run_with_project_context found a flow.toml but it contains no deployment configuration ([host], [cloudflare], [railway]) and no 'deploy' task is defined. The library refuses to guess a deployment target and bails with a message enumerating the accepted config sections and the `f deploy setup` wizard.

Source

Thrown at src/deploy.rs:367

                        task_name,
                        available_tasks(cfg)
                    );
                }

                if cfg.host.is_some() || cfg.cloudflare.is_some() || cfg.railway.is_some() {
                    return auto_deploy(&project_root, Some(cfg));
                }
                if tasks::find_task(cfg, "deploy").is_some() {
                    return tasks::run(TaskRunOpts {
                        config: config_path,
                        delegate_to_hub: false,
                        hub_host: std::net::IpAddr::from([127, 0, 0, 1]),
                        hub_port: 9050,
                        name: "deploy".to_string(),
                        args: Vec::new(),
                    });
                }
                bail!(
                    "No deployment config found in flow.toml and no 'deploy' task is defined.\n\n\
                    Add one of:\n\
                    [host]\n\
                    dest = \"/opt/myapp\"\n\
                    run = \"./server\"\n\n\
                    [cloudflare]\n\
                    path = \"worker\"\n\n\
                    [railway]\n\
                    project = \"my-project\"\n\n\
                    Or run:\n\
                    f deploy setup"
                );
            }

            bail!("No flow.toml found. Run `f setup` first.")
        }
        Some(DeployAction::Host {
            remote_build,

View on GitHub (pinned to a747e741ae)

Solutions

  1. Run `f deploy setup` to generate the deployment config interactively.
  2. Manually add a deploy section to flow.toml (e.g. `[host]` with `dest` and `run`).
  3. Define a `deploy` task in flow.toml as an alternative to a built-in section.
  4. Confirm you are in the intended project root whose flow.toml has deploy config.

Example fix

# before: flow.toml without deploy config
# after
[host]
dest = "/opt/myapp"
run = "./server"
Defensive patterns

Strategy: validation

Validate before calling

// Shell: ensure a deploy section exists in flow.toml before deploying
grep -qE '^\[(host|cloudflare|railway)\]' flow.toml || grep -qE '^\[deploy_task\.deploy\]' flow.toml \
  || { echo "flow.toml has no deploy config — run 'f deploy setup'"; exit 1; }

Prevention

When it happens

Trigger: Running `f deploy` in a project whose flow.toml has only unrelated sections (no [host]/[cloudflare]/[railway]) and no deploy task entry.

Common situations: Fresh project where `f setup` was skipped or never wrote deploy config; config file truncated or hand-edited to remove the deploy section; wrong directory — flow.toml present but belonging to a template without deploy config.

Related errors


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