{"record":{"id":"e89054450f82e707","repo":"nikivdev/code","slug":"jj-failed-e89054","errorCode":null,"errorMessage":"jj {} failed: {}","messagePattern":"jj (.+?) failed: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/jj.rs","lineNumber":3418,"sourceCode":"        .output()\n        .with_context(|| format!(\"failed to run git {}\", args.join(\" \")))?;\n    if !output.status.success() {\n        let stderr = String::from_utf8_lossy(&output.stderr);\n        bail!(\"git {} failed: {}\", args.join(\" \"), stderr.trim());\n    }\n    Ok(String::from_utf8_lossy(&output.stdout).to_string())\n}\n\nfn jj_read_in(repo_root: &Path, args: &[&str]) -> Result<String> {\n    let output = Command::new(\"jj\")\n        .current_dir(repo_root)\n        .args([\"--at-op=@\", \"--ignore-working-copy\"])\n        .args(args)\n        .output()\n        .with_context(|| format!(\"failed to run jj {}\", args.join(\" \")))?;\n    if !output.status.success() {\n        let stderr = String::from_utf8_lossy(&output.stderr);\n        bail!(\"jj {} failed: {}\", args.join(\" \"), stderr.trim());\n    }\n    Ok(String::from_utf8_lossy(&output.stdout).to_string())\n}\n\nfn jj_overview_cache() -> &'static Mutex<HashMap<JjOverviewCacheKey, CachedJjOverview>> {\n    static CACHE: OnceLock<Mutex<HashMap<JjOverviewCacheKey, CachedJjOverview>>> = OnceLock::new();\n    CACHE.get_or_init(|| Mutex::new(HashMap::new()))\n}\n\nfn cached_overview(cache_key: &JjOverviewCacheKey) -> Option<JjWorkflowOverview> {\n    let now = now_unix_secs();\n    let cache = jj_overview_cache().lock().ok()?;\n    let entry = cache.get(cache_key)?;\n    if now.saturating_sub(entry.stored_at_unix) > JJ_OVERVIEW_CACHE_TTL_SECS {\n        return None;\n    }\n    Some(entry.snapshot.clone())\n}","sourceCodeStart":3400,"sourceCodeEnd":3436,"githubUrl":"https://github.com/nikivdev/code/blob/a747e741ae92c09071d0ae946ab48488adcff1ce/src/jj.rs#L3400-L3436","documentation":"jj_read_in runs `jj --at-op=@ --ignore-working-copy <args>` for lock-free reads; on non-zero exit it raises 'jj <args> failed: <stderr>' with git-style stderr inclusion. Because --ignore-working-copy is passed, failures usually come from the repository state rather than the working copy.","triggerScenarios":"Read commands routed through jj_read_in exit non-zero — most often 'repository has conflicts' or operations requiring a snapshot running with --ignore-working-copy, or an invalid revset argument.","commonSituations":"Conflicted commits in the repo making read revsets fail; passing a revset that matches nothing or is syntactically invalid; running against a repo still being mutated by another jj process.","solutions":["Read the stderr included in the error for jj's specific complaint.","Resolve repository conflicts (`jj resolve`, then `jj rebase`) so read queries succeed.","Fix the revset/change id argument; test it directly with `jj log -r <revset>`."],"exampleFix":"// before\nflow overview  # jj_read_in fails on conflicted repo\n// after\njj resolve --list\njj resolve --tool meld <file>\nflow overview","handlingStrategy":"try-catch","validationCode":"// shell: reject conflicted repos before read commands\njj log -r 'conflicts()' -n 1 2>/dev/null | grep -q . && { echo \"repo has conflicts\" >&2; exit 1; } || true","typeGuard":null,"tryCatchPattern":"match flow_overview() {\n  Err(e) if e.contains(\"jj \") && e.contains(\"failed: \") => {\n    eprintln(\"jj read failed — resolve conflicts or fix revset, then retry\");\n    Err(e)\n  }\n  other => other,\n}","preventionTips":["Resolve `jj log -r conflicts()` entries before scripted reads.","Validate revsets with `jj log -r <expr>` before embedding them in commands.","Avoid concurrent jj mutations while running read commands."],"tags":["jj","process-exit","subprocess","revset"],"backgroundTag":"subprocess-nonzero-exit","analyzedSha":"a747e741ae92c09071d0ae946ab48488adcff1ce","analyzedAt":"2026-09-01T22:43:55.719Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}