{"record":{"id":"79a9c88586c2cab9","repo":"nikivdev/code","slug":"sync-is-blocked","errorCode":null,"errorMessage":"sync is blocked","messagePattern":"sync is blocked","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/jj.rs","lineNumber":290,"sourceCode":"    let dest = opts.dest.unwrap_or_else(|| default_branch(&ctx.repo_root));\n    let initial_target = resolve_rebase_target(&ctx.workspace_root, &dest, &remote);\n    let sync_plan = build_sync_plan(\n        &snapshot,\n        &remote,\n        &dest,\n        &initial_target,\n        opts.bookmark.as_deref(),\n        opts.no_push,\n    );\n    if opts.plan {\n        print_sync_plan(&sync_plan);\n        return Ok(());\n    }\n\n    jj_run_in(&ctx.workspace_root, &[\"git\", \"fetch\"])?;\n    let target = resolve_rebase_target(&ctx.workspace_root, &dest, &remote);\n    let sync_mode = sync_plan.mode.clone().ok_or_else(|| {\n        anyhow::anyhow!(\n            sync_plan\n                .blocked_reason\n                .clone()\n                .unwrap_or_else(|| \"sync is blocked\".to_string())\n        )\n    })?;\n    let rebase_args = sync_rebase_args(&sync_mode, &target.target);\n    jj_run_owned_in(&ctx.workspace_root, &rebase_args)?;\n    if let SyncMode::RebaseHomeBookmark { home_branch } = &sync_mode {\n        jj_run_in(\n            &ctx.workspace_root,\n            &[\"edit\", \"--ignore-immutable\", home_branch],\n        )?;\n    }\n\n    // Check for conflicts after rebase\n    let has_conflicts = jj_capture_in(\n        &ctx.workspace_root,","sourceCodeStart":272,"sourceCodeEnd":308,"githubUrl":"https://github.com/nikivdev/code/blob/a747e741ae92c09071d0ae946ab48488adcff1ce/src/jj.rs#L272-L308","documentation":"run_sync refuses to run when the computed sync plan is blocked. The plan carries an optional blocked_reason; the error surfaces that reason, or the generic \"sync is blocked\" when none was recorded. This is a deliberate precondition failure, not an unexpected crash.","triggerScenarios":"Calling `jj sync` (run → run_sync) when sync_plan.mode is None — the planner determined the workspace cannot be synced (e.g. dirty working copy, divergent state, or no valid rebase target after git fetch).","commonSituations":"Uncommitted changes blocking rebase; conflicts or divergent changes between local and remote; misconfigured remote so resolve_rebase_target can't pick a destination.","solutions":["Read the blocked_reason in the error message (or the generic one) and resolve the stated blocker","Commit or stash uncommitted changes, then rerun sync","Fetch and inspect divergence between local and remote branches","If the reason is unclear, run jj status / jj log to see what state blocks the plan"],"exampleFix":"// before\n$ jj sync  # -> sync is blocked\n// after\n$ jj status           # find blocker (dirty workspace / conflicts)\n$ jj commit -m \"wip\"\n$ jj sync","handlingStrategy":"validation","validationCode":"// before sync\nif let Some(reason) = &sync_plan.blocked_reason {\n    eprintln!(\"sync blocked: {reason}\");\n    std::process::exit(1);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Check jj status for a dirty working copy before syncing","Commit or stash changes proactively","Keep the remote configured and reachable","Read sync_plan.blocked_reason before invoking sync"],"tags":["git","jj","sync-blocked","precondition"],"backgroundTag":"sync-blocked","analyzedSha":"a747e741ae92c09071d0ae946ab48488adcff1ce","analyzedAt":"2026-09-01T22:43:55.719Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}