nikivdev/code · error

No flow.toml found. Run `f setup` first.

Error message

No flow.toml found. Run `f setup` first.

What it means

run_with_project_context reaches this bail when no flow.toml can be found in the current directory (or ancestors), for any deploy action other than the setup/host-setup paths. Deployment requires a project root containing flow.toml, so the library tells the user to run `f setup` first.

Source

Thrown at src/deploy.rs:382

                        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,
            setup,
        }) => deploy_host(&project_root, flow_config.as_ref(), remote_build, setup),
        Some(DeployAction::Cloudflare { secrets, dev }) => {
            deploy_cloudflare(&project_root, flow_config.as_ref(), secrets, dev)
        }
        Some(DeployAction::Web) => deploy_web(&project_root, flow_config.as_ref()),
        Some(DeployAction::Setup) => setup_cloudflare(&project_root, flow_config.as_ref()),
        Some(DeployAction::Railway) => deploy_railway(&project_root, flow_config.as_ref()),
        Some(DeployAction::Status) => show_status(&project_root, flow_config.as_ref()),
        Some(DeployAction::Logs {
            follow,
            since_deploy,
            all,
            lines,
        }) => show_logs(

View on GitHub (pinned to a747e741ae)

Solutions

  1. cd into the project root that contains flow.toml (or run `f setup` there).
  2. Run `f setup` to create flow.toml for a new project.
  3. Restore/commit flow.toml if it was gitignored or deleted.
  4. Verify with `ls flow.toml` before running deploy commands.

Example fix

# before
$ cd ~/ && f deploy
No flow.toml found. Run `f setup` first.
# after
$ cd ~/projects/myapp && f setup && f deploy
Defensive patterns

Strategy: validation

Validate before calling

// Shell: run deploys only from a directory that has flow.toml
[ -f flow.toml ] || { echo "no flow.toml here — cd to project root or run 'f setup'"; exit 1; }

Prevention

When it happens

Trigger: Running `f deploy ...` (or `f deploy prod`) outside any directory containing flow.toml, e.g. home directory, a non-project subfolder, or before project initialization.

Common situations: Forgetting `f setup` after cloning a fresh repo; being in the wrong terminal directory; repo where flow.toml is gitignored and not committed; shallow checkout missing config files.

Related errors


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