{"record":{"id":"01ee17d5e8e820f8","repo":"nikivdev/code","slug":"missing-profile-file","errorCode":null,"errorMessage":"Missing profile file: {}","messagePattern":"Missing profile file: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/agents.rs","lineNumber":175,"sourceCode":"        }\n    } else {\n        chosen_profile = select_agents_profile(&profiles)?;\n    }\n\n    let Some(profile_name) = chosen_profile else {\n        println!(\"No profile selected.\");\n        return Ok(());\n    };\n\n    let source_lower = agents_dir.join(format!(\"agents.{profile_name}.md\"));\n    let source_upper = agents_dir.join(format!(\"AGENTS.{profile_name}.md\"));\n    let source = if source_lower.is_file() {\n        source_lower\n    } else {\n        source_upper\n    };\n    if !source.is_file() {\n        bail!(\"Missing profile file: {}\", source.display());\n    }\n    let target = repo_path.join(\"agents.md\");\n    fs::copy(&source, &target).with_context(|| {\n        format!(\n            \"failed to copy {} to {}\",\n            source.display(),\n            target.display()\n        )\n    })?;\n\n    let default_path = agents_dir.join(\".default\");\n    fs::write(&default_path, &profile_name)\n        .with_context(|| format!(\"failed to write {}\", default_path.display()))?;\n\n    println!(\"Activated agents.md -> {}\", source.display());\n    println!(\"Default profile set to: {}\", profile_name);\n    Ok(())\n}","sourceCodeStart":157,"sourceCodeEnd":193,"githubUrl":"https://github.com/nikivdev/code/blob/a747e741ae92c09071d0ae946ab48488adcff1ce/src/agents.rs#L157-L193","documentation":"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.","triggerScenarios":"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.","commonSituations":"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).","solutions":["Install gen: cd <gen_repo_hint printed in the error> && f install.","Set the GEN_REPO environment variable to the checked-out gen repo path.","Verify find_gen's search location (expected repo path) matches where you cloned gen."],"exampleFix":"// before\n- flow agents\n# gen not found...\n// after\n+ export GEN_REPO=~/src/gen\n+ flow agents","handlingStrategy":"fallback","validationCode":"if which::which(\"gen\").is_err() && std::env::var(\"GEN_REPO\").is_err() {\n    eprintln!(\"gen missing; set GEN_REPO or run: cd ~/src/gen && f install\");\n}","typeGuard":null,"tryCatchPattern":"match build_agent_entries() {\n    Err(e) if e.to_string().contains(\"gen not found\") => {\n        // degrade to built-in agents only\n        builtin_entries()\n    }\n    Ok(v) => v,\n}","preventionTips":["Install the gen repo on every dev machine / CI image that runs flow.","Export GEN_REPO in your shell profile (not just interactive shells).","Update GEN_REPO after moving the gen checkout."],"tags":["missing-binary","environment-variable","gen","agents"],"backgroundTag":"required-executable-not-on-path","analyzedSha":"a747e741ae92c09071d0ae946ab48488adcff1ce","analyzedAt":"2026-09-01T22:43:55.719Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}