nikivdev/code · error
no repo or flow project found for {}
Error message
no repo or flow project found for {} What it means
resolve_reference_root tries to detect a repository or flow project root for a given path (via detect_reference_root). If neither a git repo nor a flow project can be identified for that path, it bails. Capsule operations (load/refresh, alias setting) require such a root to anchor their state.
Source
Thrown at src/repo_capsule.rs:294
}
fn refresh_capsule_for_root(store_dir: &Path, root: &Path) -> Result<RepoCapsule> {
let capsule = build_capsule(root)?;
save_capsule(store_dir, &capsule)?;
Ok(capsule)
}
fn resolve_target_path(path: Option<&str>) -> Result<PathBuf> {
let base = match path.map(str::trim).filter(|value| !value.is_empty()) {
Some(value) => config::expand_path(value),
None => std::env::current_dir().context("read current dir")?,
};
Ok(base.canonicalize().unwrap_or(base))
}
fn resolve_reference_root(path: &Path) -> Result<PathBuf> {
let Some(root) = detect_reference_root(path) else {
bail!("no repo or flow project found for {}", path.display());
};
Ok(root)
}
fn resolve_candidate_root(target_path: &Path, candidate: &str) -> Option<PathBuf> {
let trimmed = candidate.trim();
if trimmed.is_empty() {
return None;
}
let expanded = if trimmed.starts_with("~/") {
config::expand_path(trimmed)
} else if Path::new(trimmed).is_absolute() {
PathBuf::from(trimmed)
} else if trimmed.starts_with("./") || trimmed.starts_with("../") {
target_path.join(trimmed)
} else {
return None;View on GitHub (pinned to a747e741ae)
Solutions
- cd into a directory inside a git repository (or a flow project) and retry
- Initialize a repo/project at the intended location (`git init` or the flow project equivalent)
- Pass an explicit correct path if the tool accepts one
Example fix
// before cd /tmp && f capsule refresh // after cd ~/code/my-project && f capsule refresh
Defensive patterns
Strategy: validation
Validate before calling
const { execSync } = require("child_process");
function insideRepoOrFlowProject(dir) {
try { execSync("git rev-parse --show-toplevel", { cwd: dir, stdio: "ignore" }); return true; }
catch { return false; } // add flow-project marker check if applicable
}
if (!insideRepoOrFlowProject(process.cwd())) throw new Error("run this from inside a git repo or flow project"); Try / catch
try {
run(["f", "capsule", "refresh"]);
} catch (e) {
if (String(e).startsWith("no repo or flow project found")) {
console.error("cd into a git repo or flow project first.");
} else throw e;
} Prevention
- Only run capsule/alias commands from inside a git repository or flow project
- Check for a .git (or flow project marker) in the current directory or ancestors before invoking
- Initialize the project (`git init`) if the directory is meant to be one
When it happens
Trigger: Calling `f capsule` load/refresh or setting an alias from a path outside any git repository and outside any flow project.
Common situations: Running the command in a plain directory (e.g. /tmp or home); being inside a subdirectory whose parents contain no .git or flow marker; typos in a path argument.
Related errors
- jj git export retry loop should always return
- fzf not found on PATH – install it to use fuzzy selection.
- moon build output directory missing: {}
- Refusing to overwrite {}
- Refusing to overwrite {}
AI-assisted analysis of nikivdev/code@a747e741ae (2026-09-01).
Data as JSON: /api/errors/eca7ca972f1cb62e.
Report an issue: GitHub.