nikivdev/code · error · anyhow::Error
No flow.toml found in current directory
Error message
No flow.toml found in current directory
What it means
sync_skills syncs tasks from a flow.toml file in the current directory into the skills directory. Before doing anything it checks cwd.join("flow.toml").exists(); if the file is absent it bails immediately. This is a plain precondition failure: the command was run outside a directory containing a flow.toml.
Source
Thrown at src/skills.rs:1320
if !existed {
created += 1;
} else if should_write || normalized {
updated += 1;
}
write_task_skill_metadata(&skill_dir, task, options)?;
}
Ok((created, updated))
}
/// Sync flow.toml tasks as skills.
fn sync_skills() -> Result<()> {
let cwd = std::env::current_dir()?;
let flow_toml = cwd.join("flow.toml");
if !flow_toml.exists() {
bail!("No flow.toml found in current directory");
}
// Load flow.toml
let cfg = config::load(&flow_toml)?;
let skills_dir = get_skills_dir()?;
let normalized = normalize_skill_files(&skills_dir)?;
let options = resolve_skill_sync_options(cfg.skills.as_ref());
let (created, updated) = sync_tasks_to_skills(&skills_dir, &cfg.tasks, options)?;
// Ensure symlinks exist for Claude Code and Codex
ensure_symlinks()?;
println!("Synced {} tasks from flow.toml", cfg.tasks.len());
if created > 0 {
println!(" Created: {}", created);
}
if updated > 0 {View on GitHub (pinned to a747e741ae)
Solutions
- cd to the directory containing flow.toml and rerun the sync command
- Create a flow.toml in the current directory if one is intended
- Support an explicit --config <path> flag or FLOW_TOML env var so cwd doesn't matter
- Fix CI/IDE working-directory configuration to point at the project root
Example fix
// before: depends entirely on cwd
let cwd = std::env::current_dir()?;
let flow_toml = cwd.join("flow.toml");
// after: allow explicit override
let flow_toml = std::env::var_os("FLOW_TOML")
.map(std::path::PathBuf::from)
.unwrap_or_else(|| std::env::current_dir().unwrap().join("flow.toml")); Defensive patterns
Strategy: validation
Validate before calling
let flow_toml = std::path::Path::new("flow.toml");
if !flow_toml.exists() {
return Err(anyhow::anyhow!(
"No flow.toml in {} — run from the project root",
std::env::current_dir()?.display()
));
} Try / catch
match sync_skills() {
Ok(()) => println!("skills synced"),
Err(e) if e.to_string().contains("No flow.toml") => {
eprintln!("Run this command from the directory containing flow.toml");
std::process::exit(2);
}
Err(e) => return Err(e),
} Prevention
- Always run the sync command from the project root containing flow.toml
- Set the working directory explicitly in CI configs and IDE run configurations
- Check for flow.toml with a quick `test -f flow.toml` before invoking
- Support an explicit config path flag so cwd dependence disappears
When it happens
Trigger: Running the `sync` command from a directory with no flow.toml; being in a subdirectory of the project instead of the project root; flow.toml renamed or deleted; typo'd working directory.
Common situations: Developer runs the CLI from home directory or repo root when flow.toml lives in a subfolder; CI working directory set to the wrong path; project uses a different config filename after a migration.
Related errors
- Postgres project path not found: {} (override with --project
- expected [{}] to be a table in global flow config
- deploy_task '{}' not found. Available tasks: {}
- No deployment config found in flow.toml. Add one of: [host]
- No flow.toml found. Run `f setup` first.
AI-assisted analysis of nikivdev/code@a747e741ae (2026-09-01).
Data as JSON: /api/errors/ba17ef12d8e32eaa.
Report an issue: GitHub.