{"record":{"id":"ebb8d6216b55de70","repo":"nikivdev/code","slug":"failed-ebb8d6","errorCode":null,"errorMessage":"{} {} failed: {}","messagePattern":"(.+?) (.+?) failed: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/sync.rs","lineNumber":4699,"sourceCode":"}\n\nfn jj_run_preferred_in(repo_root: &Path, args: &[&str]) -> Result<()> {\n    let jj_bin = jj_preferred_binary();\n    let output = Command::new(&jj_bin)\n        .current_dir(repo_root)\n        .args(args)\n        .output()\n        .with_context(|| format!(\"failed to run {} {}\", jj_bin.display(), args.join(\" \")))?;\n    if !output.status.success() {\n        let stderr = String::from_utf8_lossy(&output.stderr);\n        let stdout = String::from_utf8_lossy(&output.stdout);\n        let concise = stderr\n            .lines()\n            .chain(stdout.lines())\n            .map(str::trim)\n            .find(|line| !line.is_empty())\n            .unwrap_or(\"jj command failed\");\n        bail!(\n            \"{} {} failed: {}\",\n            jj_bin.display(),\n            args.join(\" \"),\n            concise\n        );\n    }\n    Ok(())\n}\n\nfn jj_bookmark_exists(repo_root: &Path, name: &str) -> bool {\n    let output = jj_capture_in(repo_root, &[\"bookmark\", \"list\"]).unwrap_or_default();\n    output\n        .lines()\n        .any(|line| line.trim_start().starts_with(name))\n}\n\nfn jj_bookmark_create_or_set(repo_root: &Path, name: &str, rev: &str) -> Result<()> {\n    if jj_bookmark_exists(repo_root, name) {","sourceCodeStart":4681,"sourceCodeEnd":4717,"githubUrl":"https://github.com/nikivdev/code/blob/a747e741ae92c09071d0ae946ab48488adcff1ce/src/sync.rs#L4681-L4717","documentation":"Raised by jj_run_output_in in src/sync.rs when a jj command fails. It extracts the first non-empty trimmed line from stderr (falling back to stdout), or the literal \"jj command failed\", and formats it as `<jj_bin> <args> failed: <concise>`. This gives a single-line actionable summary of a jj invocation failure.","triggerScenarios":"A jj command run through jj_run_output_in exits non-zero and the caller formats the failure with jj_bin.display(), the joined args, and the first non-empty stderr/stdout line.","commonSituations":"jj rejects an operation due to repo conflicts, missing remote, bad revision names, or auth failures; environment binary issues surfaced through stderr.","solutions":["Read the `concise` line to identify the exact jj error","Run the failing command manually (`<jj_bin> <args>`) to see complete output","Resolve the underlying issue (fix revision, authenticate, resolve conflicts) and retry","Ensure FLOW_JJ_BIN resolves to a working jj binary"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// sanity-check jj can read the repo before heavy sync operations\nlet out = std::process::Command::new(jj_bin()).args([\"st\"]).output()?;\nif !out.status.success() {\n    eprintln!(\"jj st failed: {}\", String::from_utf8_lossy(&out.stderr));\n}","typeGuard":null,"tryCatchPattern":"match sync_result {\n    Err(e) if e.to_string().contains(\"failed:\") && e.to_string().contains(\"jj\") => {\n        // concise stderr line is embedded after the second ': '\n        eprintln!(\"{e}\");\n    }\n    other => other?,\n}","preventionTips":["Run `jj st` as a preflight before sync","Fix reported stderr issues (rev names, remotes, auth) before retrying","Avoid constructing jj args from unvalidated input","Keep the jj binary on PATH or set FLOW_JJ_BIN correctly"],"tags":["jj","stderr","command-failure","sync"],"backgroundTag":"jj-command-failed","analyzedSha":"a747e741ae92c09071d0ae946ab48488adcff1ce","analyzedAt":"2026-09-01T22:43:55.719Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}