{"record":{"id":"8c40036a7c457238","repo":"nikivdev/code","slug":"diff-bundle-not-found-expected-or-pass-a-path","errorCode":null,"errorMessage":"Diff bundle not found. Expected {} or pass a path to a bundle file.","messagePattern":"Diff bundle not found\\. Expected (.+?) or pass a path to a bundle file\\.","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/changes.rs","lineNumber":580,"sourceCode":"fn write_bundle(bundle: &DiffBundle) -> Result<PathBuf> {\n    let diffs_dir = bundle_dir()?;\n    let path = diffs_dir.join(format!(\"{}.json\", bundle.hash));\n    let payload = serde_json::to_string_pretty(bundle).context(\"failed to serialize bundle\")?;\n    fs::write(&path, payload).with_context(|| format!(\"failed to write {}\", path.display()))?;\n    Ok(path)\n}\n\nfn read_bundle(id: &str) -> Result<(DiffBundle, Option<PathBuf>)> {\n    let candidate = PathBuf::from(id);\n    let path = if candidate.exists() {\n        candidate\n    } else {\n        bundle_dir()?.join(format!(\"{}.json\", id))\n    };\n\n    if !path.exists() {\n        trace(&format!(\"bundle lookup failed: {}\", path.display()));\n        bail!(\n            \"Diff bundle not found. Expected {} or pass a path to a bundle file.\",\n            path.display()\n        );\n    }\n\n    trace(&format!(\"bundle read: {}\", path.display()));\n    let data =\n        fs::read_to_string(&path).with_context(|| format!(\"failed to read {}\", path.display()))?;\n    let bundle: DiffBundle = serde_json::from_str(&data)\n        .with_context(|| format!(\"failed to parse {}\", path.display()))?;\n\n    let expected = if bundle.version <= 1 {\n        let payload = DiffBundlePayloadV1 {\n            version: bundle.version,\n            created_at: bundle.created_at.clone(),\n            repo_root: bundle.repo_root.clone(),\n            base_ref: bundle.base_ref.clone(),\n            diff: bundle.diff.clone(),","sourceCodeStart":562,"sourceCodeEnd":598,"githubUrl":"https://github.com/nikivdev/code/blob/a747e741ae92c09071d0ae946ab48488adcff1ce/src/changes.rs#L562-L598","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\n$ f unroll abc123\nError: Diff bundle not found. Expected /root/.flow/bundles/abc123.json or pass a path...\n// after: pass an explicit path\n$ f unroll ~/bundles/abc123.json","handlingStrategy":"validation","validationCode":"// Shell: check the bundle exists before unrolling\nBUNDLE=\"${1:?usage: f unroll <id-or-path>}\"\n[[ -f \"$BUNDLE\" || -f \"$HOME/.flow/bundles/$BUNDLE.json\" ]] || { echo \"bundle not found: $BUNDLE\" >&2; exit 1; }","typeGuard":null,"tryCatchPattern":"match read_bundle(id) {\n    Err(e) if e.to_string().contains(\"Diff bundle not found\") => {\n        eprintln!(\"No such bundle; available: {}\", list_bundle_ids()?.join(\", \"));\n    }\n    other => other?,\n}","preventionTips":["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"],"tags":["file-not-found","cli","rust"],"backgroundTag":"file-not-found","analyzedSha":"a747e741ae92c09071d0ae946ab48488adcff1ce","analyzedAt":"2026-09-01T22:43:55.719Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}