nikivdev/code · error

No flow.toml found in current directory or global config

Error message

No flow.toml found in current directory or global config

What it means

proxy_command needs a flow.toml configuration to know what to proxy; it looks in the current directory first and falls back to the global config (~/.config/flow/flow.toml). When neither exists it bails with this message, because proxy actions cannot proceed without configuration.

Solutions

  1. cd into the project directory that contains flow.toml before running the proxy command.
  2. Create the global config at ~/.config/flow/flow.toml (Linux) or the platform equivalent of dirs::config_dir()/flow/flow.toml.
  3. Create a flow.toml in the current directory with the required proxy settings.
  4. Verify with `ls flow.toml` / `ls "${XDG_CONFIG_HOME:-$HOME/.config}/flow/flow.toml"` which path is expected.

Example fix

# before
cd /tmp && flow proxy start   # no flow.toml here
# after
cd ~/projects/myapp           # contains flow.toml
flow proxy start
# or create a global one:
mkdir -p ~/.config/flow && printf '[proxy]\nport = 8080\n' > ~/.config/flow/flow.toml
Defensive patterns

Strategy: validation

Validate before calling

use std::path::PathBuf;
fn flow_config_present() -> bool {
    PathBuf::from("flow.toml").exists()
        || dirs::config_dir().map(|d| d.join("flow").join("flow.toml").exists()).unwrap_or(false)
}
if !flow_config_present() {
    eprintln!("create flow.toml in the project dir or ~/.config/flow/flow.toml");
    std::process::exit(1);
}

Type guard

fn resolve_flow_config() -> Option<PathBuf> {
    let local = PathBuf::from("flow.toml");
    if local.exists() { return Some(local); }
    dirs::config_dir().map(|d| d.join("flow").join("flow.toml")).filter(|p| p.exists())
}

Try / catch

match proxy_command(args) {
    Err(e) if e.to_string().contains("No flow.toml found") => {
        eprintln!("Run from a project dir containing flow.toml, or create ~/.config/flow/flow.toml");
        std::process::exit(1);
    }
    other => other?,
}

Prevention

When it happens

Trigger: Running a proxy subcommand (ProxyAction::Start etc.) outside any directory containing flow.toml while no global config file exists at the platform config dir (dirs::config_dir()/flow/flow.toml).

Common situations: Running the proxy from $HOME or a temp dir instead of the project root; fresh install where the global config was never created; config file named differently or placed in a nonstandard location.

Understand the failure class

Background: "Config file not found": what it means and how to fix it in docker-sync, Maven, Vagrant, Turborepo and other tools — this error's family across 60 libraries.

Related errors


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

Appendix: source

Thrown at src/main.rs:1036

}

/// Handle proxy commands
fn proxy_command(cmd: ProxyCommand) -> Result<()> {
    // Helper to load config from current directory
    let load_project_config = || -> Result<flowd::config::Config> {
        let cwd = std::env::current_dir()?;
        let flow_toml = cwd.join("flow.toml");
        if flow_toml.exists() {
            flowd::config::load(&flow_toml)
        } else {
            // Try global config
            let global = dirs::config_dir()
                .map(|d| d.join("flow").join("flow.toml"))
                .filter(|p| p.exists());
            if let Some(path) = global {
                flowd::config::load(&path)
            } else {
                bail!("No flow.toml found in current directory or global config");
            }
        }
    };

    match cmd.action {
        ProxyAction::Start(opts) => {
            // Load config
            let config = load_project_config()?;
            let proxy_config = config.proxy.unwrap_or_default();
            let targets = config.proxies;

            if targets.is_empty() {
                bail!("No proxy targets configured. Add [[proxies]] to flow.toml");
            }

            // Override listen if provided
            let proxy_config = if let Some(listen) = opts.listen {
                proxy::ProxyConfig {

View on GitHub (pinned to a747e741ae)