{"record":{"id":"fb09682a1340f67e","repo":"nikivdev/code","slug":"jj-failed-fb0968","errorCode":null,"errorMessage":"jj {} failed","messagePattern":"jj (.+?) failed","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/jj.rs","lineNumber":3379,"sourceCode":"fn jj_run_in(repo_root: &Path, args: &[&str]) -> Result<()> {\n    let output = Command::new(\"jj\")\n        .current_dir(repo_root)\n        .args(args)\n        .output()\n        .with_context(|| format!(\"failed to run jj {}\", args.join(\" \")))?;\n    let stdout = String::from_utf8_lossy(&output.stdout);\n    if !stdout.trim().is_empty() {\n        print!(\"{}\", stdout);\n    }\n    let stderr = String::from_utf8_lossy(&output.stderr);\n    for line in stderr.lines() {\n        if line.contains(\"Refused to snapshot\") {\n            continue;\n        }\n        eprintln!(\"{}\", line);\n    }\n    if !output.status.success() {\n        bail!(\"jj {} failed\", args.join(\" \"));\n    }\n    Ok(())\n}\n\nfn jj_capture_in(repo_root: &Path, args: &[&str]) -> Result<String> {\n    let output = Command::new(\"jj\")\n        .current_dir(repo_root)\n        .args(args)\n        .output()\n        .with_context(|| format!(\"failed to run jj {}\", args.join(\" \")))?;\n    if !output.status.success() {\n        bail!(\"jj {} failed\", args.join(\" \"));\n    }\n    Ok(String::from_utf8_lossy(&output.stdout).to_string())\n}\n\nfn git_capture_in(repo_root: &Path, args: &[&str]) -> Result<String> {\n    let output = Command::new(\"git\")","sourceCodeStart":3361,"sourceCodeEnd":3397,"githubUrl":"https://github.com/nikivdev/code/blob/a747e741ae92c09071d0ae946ab48488adcff1ce/src/jj.rs#L3361-L3397","documentation":"jj_run_in shells out to the `jj` CLI and streams its stderr, filtering only 'Refused to snapshot' lines. If jj exits non-zero, the wrapper raises a generic 'jj <args> failed' error. The real reason is on stderr above this message in the terminal output.","triggerScenarios":"Any jj subcommand invoked through jj_run_in (push, edit, new, workspace ops, etc.) exits with a non-zero status — e.g. push rejected by remote, workspace not found, conflicting operation.","commonSituations":"Remote rejected the push (non-fast-forward, protected branch); jj version mismatch or out-of-date working copy needing `jj workspace update-stale`; network/auth failures during git push under the hood.","solutions":["Read the stderr lines printed above the error for jj's actual message and fix that root cause.","If the working copy is stale, run `jj workspace update-stale` and retry.","For push rejections, `jj rebase` / `jj git fetch` then re-push; verify auth with `jj git push --bookmark <name>` directly."],"exampleFix":"// before\njj git push --bookmark feature  # remote rejects\n// after\njj git fetch\njj rebase -d main\nflow push --bookmark feature","handlingStrategy":"try-catch","validationCode":"// shell: pre-flight before push\njj workspace update-stale 2>/dev/null || true\njj bookmark list | grep -q \"$BOOKMARK\" || { echo \"no such bookmark\" >&2; exit 1; }","typeGuard":null,"tryCatchPattern":"match flow_push(&opts) {\n  Err(e) if e.starts_with(\"jj git push failed\") => {\n    eprintln(\"jj push failed — inspect stderr above; try jj git fetch + rebase, then retry\");\n    Err(e)\n  }\n  other => other,\n}","preventionTips":["Fetch and rebase before pushing to avoid remote rejections.","Run `jj workspace update-stale` after other tools touched the repo.","Keep the raw jj stderr (it is printed) when reporting issues."],"tags":["jj","process-exit","subprocess","cli"],"backgroundTag":"subprocess-nonzero-exit","analyzedSha":"a747e741ae92c09071d0ae946ab48488adcff1ce","analyzedAt":"2026-09-01T22:43:55.719Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}