{"record":{"id":"f522f5202394b111","repo":"nikivdev/code","slug":"jj-git-export-retry-loop-should-always-return","errorCode":null,"errorMessage":"jj git export retry loop should always return","messagePattern":"jj git export retry loop should always return","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/sync.rs","lineNumber":4653,"sourceCode":"            std::thread::sleep(delay);\n            continue;\n        }\n\n        jj_print_output(&output);\n        let failure = jj_failure_message(&args, &output);\n        if is_git_index_lock_error(&failure_text) {\n            let retries = JJ_GIT_EXPORT_LOCK_RETRY_DELAYS_MS.len();\n            bail!(\n                \"{}. Git index stayed locked after {} retr{}; close competing git/jj processes or remove stale .git/index.lock, then retry.\",\n                failure,\n                retries,\n                if retries == 1 { \"y\" } else { \"ies\" }\n            );\n        }\n        bail!(\"{}\", failure);\n    }\n\n    unreachable!(\"jj git export retry loop should always return\");\n}\n\nfn jj_run_in(repo_root: &Path, args: &[&str]) -> Result<()> {\n    let output = jj_run_output_in(repo_root, args)?;\n    jj_print_output(&output);\n    if !output.status.success() {\n        bail!(\"{}\", jj_failure_message(args, &output));\n    }\n    Ok(())\n}\n\nfn jj_preferred_binary() -> std::path::PathBuf {\n    if let Ok(path) = std::env::var(\"FLOW_JJ_BIN\") {\n        let candidate = PathBuf::from(path);\n        if candidate.exists() {\n            return candidate;\n        }\n    }","sourceCodeStart":4635,"sourceCodeEnd":4671,"githubUrl":"https://github.com/nikivdev/code/blob/a747e741ae92c09071d0ae946ab48488adcff1ce/src/sync.rs#L4635-L4671","documentation":"This error is thrown by a repository-marker resolution routine in src/workflow.rs (near line 784). Given a repo marker path (e.g. a .git or .jj marker), it tries git/jj resolution branches; if none applies and the marker file simply does not exist on disk, it bails with \"expected <marker path> to exist\". It is a precondition assertion that the marker file representing the repo was present.","triggerScenarios":"Calling the repo-resolution helper with a repo_marker path whose file/directory does not exist on disk, and the path is not under a .jj repo (so the jj parent-resolution branch is skipped).","commonSituations":"A workspace entry pointing at a moved/deleted repo; config referencing a repo path that was never cloned; a stale cache entry after the repository directory was removed; running from a subpath after the repo was relocated.","solutions":["Verify the repo marker path shown in the message exists (ls <path>); recreate/re-clone the repo if deleted.","Fix the workspace/config entry that references the stale repository path.","Run the workflow from the correct repo root so the marker resolves."],"exampleFix":"// before (stale path in workspace config)\nrepo_marker = /home/user/work/old-repo/.git\n// after\n+ git clone git@host:work/old-repo.git /home/user/work/old-repo\n+ # or update config to the new path /home/user/work/new-repo/.git","handlingStrategy":"validation","validationCode":"if !std::path::Path::new(&repo_marker).exists() {\n    return Err(anyhow!(\"repo marker {} missing; fix workspace config\", repo_marker.display()));\n}","typeGuard":"fn repo_marker_exists(p: &std::path::Path) -> bool { p.exists() }","tryCatchPattern":"match resolve_repo_marker(marker) {\n    Err(e) if e.to_string().contains(\"expected\") && e.to_string().contains(\"to exist\") => {\n        eprintln!(\"re-clone or fix the workspace path: {}\", marker.display());\n    }\n    r => r?,\n}","preventionTips":["Keep workspace config paths in sync when moving/cloning repos.","Check repo existence before running multi-repo workflows.","Avoid deleting repo directories referenced by active workspaces."],"tags":["filesystem","missing-path","git","workflow"],"backgroundTag":"expected-file-not-found","analyzedSha":"a747e741ae92c09071d0ae946ab48488adcff1ce","analyzedAt":"2026-09-01T22:43:55.719Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}