{"record":{"id":"56a3da2f343bdc54","repo":"nikivdev/code","slug":"no-flow-toml-found-in-current-directory-or-global","errorCode":null,"errorMessage":"No flow.toml found in current directory or global config","messagePattern":"No flow\\.toml found in current directory or global config","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/main.rs","lineNumber":1036,"sourceCode":"}\n\n/// Handle proxy commands\nfn proxy_command(cmd: ProxyCommand) -> Result<()> {\n    // Helper to load config from current directory\n    let load_project_config = || -> Result<flowd::config::Config> {\n        let cwd = std::env::current_dir()?;\n        let flow_toml = cwd.join(\"flow.toml\");\n        if flow_toml.exists() {\n            flowd::config::load(&flow_toml)\n        } else {\n            // Try global config\n            let global = dirs::config_dir()\n                .map(|d| d.join(\"flow\").join(\"flow.toml\"))\n                .filter(|p| p.exists());\n            if let Some(path) = global {\n                flowd::config::load(&path)\n            } else {\n                bail!(\"No flow.toml found in current directory or global config\");\n            }\n        }\n    };\n\n    match cmd.action {\n        ProxyAction::Start(opts) => {\n            // Load config\n            let config = load_project_config()?;\n            let proxy_config = config.proxy.unwrap_or_default();\n            let targets = config.proxies;\n\n            if targets.is_empty() {\n                bail!(\"No proxy targets configured. Add [[proxies]] to flow.toml\");\n            }\n\n            // Override listen if provided\n            let proxy_config = if let Some(listen) = opts.listen {\n                proxy::ProxyConfig {","sourceCodeStart":1018,"sourceCodeEnd":1054,"githubUrl":"https://github.com/nikivdev/code/blob/a747e741ae92c09071d0ae946ab48488adcff1ce/src/main.rs#L1018-L1054","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["cd into the project directory that contains flow.toml before running the proxy command.","Create the global config at ~/.config/flow/flow.toml (Linux) or the platform equivalent of dirs::config_dir()/flow/flow.toml.","Create a flow.toml in the current directory with the required proxy settings.","Verify with `ls flow.toml` / `ls \"${XDG_CONFIG_HOME:-$HOME/.config}/flow/flow.toml\"` which path is expected."],"exampleFix":"# before\ncd /tmp && flow proxy start   # no flow.toml here\n# after\ncd ~/projects/myapp           # contains flow.toml\nflow proxy start\n# or create a global one:\nmkdir -p ~/.config/flow && printf '[proxy]\\nport = 8080\\n' > ~/.config/flow/flow.toml","handlingStrategy":"validation","validationCode":"use std::path::PathBuf;\nfn flow_config_present() -> bool {\n    PathBuf::from(\"flow.toml\").exists()\n        || dirs::config_dir().map(|d| d.join(\"flow\").join(\"flow.toml\").exists()).unwrap_or(false)\n}\nif !flow_config_present() {\n    eprintln!(\"create flow.toml in the project dir or ~/.config/flow/flow.toml\");\n    std::process::exit(1);\n}","typeGuard":"fn resolve_flow_config() -> Option<PathBuf> {\n    let local = PathBuf::from(\"flow.toml\");\n    if local.exists() { return Some(local); }\n    dirs::config_dir().map(|d| d.join(\"flow\").join(\"flow.toml\")).filter(|p| p.exists())\n}","tryCatchPattern":"match proxy_command(args) {\n    Err(e) if e.to_string().contains(\"No flow.toml found\") => {\n        eprintln!(\"Run from a project dir containing flow.toml, or create ~/.config/flow/flow.toml\");\n        std::process::exit(1);\n    }\n    other => other?,\n}","preventionTips":["Run proxy commands from the project root containing flow.toml.","Create the global config once after install: ~/.config/flow/flow.toml.","Check for the config file in scripts before invoking proxy actions.","Keep the filename exactly `flow.toml` — alternate names are not discovered."],"tags":["config","proxy","missing-file"],"backgroundTag":"config-file-not-found","analyzedSha":"a747e741ae92c09071d0ae946ab48488adcff1ce","analyzedAt":"2026-09-01T22:43:55.719Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}