nikivdev/code · error
Diff bundle not found. Expected {} or pass a path to a bundl
Error message
Diff bundle not found. Expected {} or pass a path to a bundle file. What it means
Thrown by read_bundle (src/changes.rs:580) when the JSON bundle file for the given id cannot be found at the expected bundle directory location (<bundle_dir>/<id>.json). The error message includes the full path checked so the user can locate the file manually or pass an explicit path instead.
Source
Thrown at src/changes.rs:580
fn write_bundle(bundle: &DiffBundle) -> Result<PathBuf> {
let diffs_dir = bundle_dir()?;
let path = diffs_dir.join(format!("{}.json", bundle.hash));
let payload = serde_json::to_string_pretty(bundle).context("failed to serialize bundle")?;
fs::write(&path, payload).with_context(|| format!("failed to write {}", path.display()))?;
Ok(path)
}
fn read_bundle(id: &str) -> Result<(DiffBundle, Option<PathBuf>)> {
let candidate = PathBuf::from(id);
let path = if candidate.exists() {
candidate
} else {
bundle_dir()?.join(format!("{}.json", id))
};
if !path.exists() {
trace(&format!("bundle lookup failed: {}", path.display()));
bail!(
"Diff bundle not found. Expected {} or pass a path to a bundle file.",
path.display()
);
}
trace(&format!("bundle read: {}", path.display()));
let data =
fs::read_to_string(&path).with_context(|| format!("failed to read {}", path.display()))?;
let bundle: DiffBundle = serde_json::from_str(&data)
.with_context(|| format!("failed to parse {}", path.display()))?;
let expected = if bundle.version <= 1 {
let payload = DiffBundlePayloadV1 {
version: bundle.version,
created_at: bundle.created_at.clone(),
repo_root: bundle.repo_root.clone(),
base_ref: bundle.base_ref.clone(),
diff: bundle.diff.clone(),View on GitHub (pinned to a747e741ae)
Solutions
- List the bundle directory and confirm the exact bundle id: the message shows the expected path, check that file exists.
- Pass the full path to the bundle file directly instead of the id (e.g. `f unroll ~/bundles/abc123.json`).
- Recreate the bundle in the source repo with the current flow, then unroll it.
- Copy the bundle file from the machine/repo where it was created into the expected bundle directory.
Example fix
// before $ f unroll abc123 Error: Diff bundle not found. Expected /root/.flow/bundles/abc123.json or pass a path... // after: pass an explicit path $ f unroll ~/bundles/abc123.json
Defensive patterns
Strategy: validation
Validate before calling
// Shell: check the bundle exists before unrolling
BUNDLE="${1:?usage: f unroll <id-or-path>}"
[[ -f "$BUNDLE" || -f "$HOME/.flow/bundles/$BUNDLE.json" ]] || { echo "bundle not found: $BUNDLE" >&2; exit 1; } Try / catch
match read_bundle(id) {
Err(e) if e.to_string().contains("Diff bundle not found") => {
eprintln!("No such bundle; available: {}", list_bundle_ids()?.join(", "));
}
other => other?,
} Prevention
- Pass the full file path instead of a short id to avoid bundle-dir resolution surprises
- List the bundle directory (`ls ~/.flow/bundles/`) to confirm ids before invoking
- Don't delete bundles until the unroll is confirmed complete
When it happens
Trigger: Running `f unroll <id>` where no file named `<id>.json` exists in the bundle directory (bundle_dir() resolved path), and the argument was not a valid existing file path.
Common situations: Typo in the bundle id; bundle deleted or never created; running from a machine where the bundle directory is empty; bundle stored under a custom path that was never passed as a path argument; a completed/cleaned-up bundle after unroll removed it.
Understand the failure class
Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.
Related errors
- Template not found: {}
- Source folder does not exist: {}
- Could not find agent file for '{}'
- enable-global is only supported for Codex sessions; use `f c
- Project mismatch. Bundle is for '{}' but this repo is '{}'.
AI-assisted analysis of nikivdev/code@a747e741ae (2026-09-01).
Data as JSON: /api/errors/8c40036a7c457238.
Report an issue: GitHub.