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

  1. cd to the directory containing flow.toml and rerun the sync command
  2. Create a flow.toml in the current directory if one is intended
  3. Support an explicit --config <path> flag or FLOW_TOML env var so cwd doesn't matter
  4. 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

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


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