nikivdev/code · error

Missing profile file: {}

Error message

Missing profile file: {}

What it means

fetch_gen_agent_entries in src/agents.rs calls find_gen() to locate the external `gen` binary/repo; when it returns None it bails with instructions to install gen (cd <gen_repo_hint> && f install) or set the GEN_REPO env var. This happens while building the agent entry list, so gen-provided agents are unavailable.

Source

Thrown at src/agents.rs:175

        }
    } else {
        chosen_profile = select_agents_profile(&profiles)?;
    }

    let Some(profile_name) = chosen_profile else {
        println!("No profile selected.");
        return Ok(());
    };

    let source_lower = agents_dir.join(format!("agents.{profile_name}.md"));
    let source_upper = agents_dir.join(format!("AGENTS.{profile_name}.md"));
    let source = if source_lower.is_file() {
        source_lower
    } else {
        source_upper
    };
    if !source.is_file() {
        bail!("Missing profile file: {}", source.display());
    }
    let target = repo_path.join("agents.md");
    fs::copy(&source, &target).with_context(|| {
        format!(
            "failed to copy {} to {}",
            source.display(),
            target.display()
        )
    })?;

    let default_path = agents_dir.join(".default");
    fs::write(&default_path, &profile_name)
        .with_context(|| format!("failed to write {}", default_path.display()))?;

    println!("Activated agents.md -> {}", source.display());
    println!("Default profile set to: {}", profile_name);
    Ok(())
}

View on GitHub (pinned to a747e741ae)

Solutions

  1. Install gen: cd <gen_repo_hint printed in the error> && f install.
  2. Set the GEN_REPO environment variable to the checked-out gen repo path.
  3. Verify find_gen's search location (expected repo path) matches where you cloned gen.

Example fix

// before
- flow agents
# gen not found...
// after
+ export GEN_REPO=~/src/gen
+ flow agents
Defensive patterns

Strategy: fallback

Validate before calling

if which::which("gen").is_err() && std::env::var("GEN_REPO").is_err() {
    eprintln!("gen missing; set GEN_REPO or run: cd ~/src/gen && f install");
}

Try / catch

match build_agent_entries() {
    Err(e) if e.to_string().contains("gen not found") => {
        // degrade to built-in agents only
        builtin_entries()
    }
    Ok(v) => v,
}

Prevention

When it happens

Trigger: Invoking any path that enumerates agents (build_agent_entries) when the gen binary/repo is neither found at the expected location nor locatable via GEN_REPO.

Common situations: Fresh clone of flow without installing the companion gen repo; GEN_REPO pointing at a moved/renamed path; running from an environment without the repo checked out (CI, new laptop).

Related errors


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