{"record":{"id":"08c0ee6c4b1608cf","repo":"nikivdev/code","slug":"failed-to-restore-sync-auto-stash-automatically-r-08c0ee","errorCode":null,"errorMessage":"failed to restore sync auto-stash automatically. Run `git stash list` and restore manually if needed.","messagePattern":"failed to restore sync auto-stash automatically\\. Run `git stash list` and restore manually if needed\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/sync.rs","lineNumber":5223,"sourceCode":"        write_sync_repair_packet(\n            repo_root,\n            SyncRepairKind::StashRestoreConflict,\n            &conflicted_files,\n            detail,\n            None,\n            Some(auto_stash_state),\n            packet_dir_override,\n        )\n        .ok()\n    };\n    if detail.is_empty() {\n        if let Some(packet_path) = repair_packet_path {\n            bail!(\n                \"failed to restore sync auto-stash automatically. Run `:sync repair --packet {}` or `git stash list` and restore manually if needed.\",\n                packet_path.display()\n            );\n        }\n        bail!(\n            \"failed to restore sync auto-stash automatically. Run `git stash list` and restore manually if needed.\"\n        );\n    }\n\n    if let Some(packet_path) = repair_packet_path {\n        if allow_autofix {\n            match try_route_sync_conflicts_to_sync_agent(repo_root, &packet_path)? {\n                SyncRepairRouteOutcome::Completed => {\n                    restore_intent_to_add_paths(repo_root, &auto_stash_state.intent_to_add_paths)\n                        .context(\"restored stash but could not restore intent-to-add markers\")?;\n                    if drop_latest_stash_if_present(repo_root)? {\n                        sync_progressln!(\n                            \"  ✓ Sync agent resolved stash conflicts and dropped auto-stash\"\n                        );\n                    } else {\n                        sync_progressln!(\"  ✓ Sync agent resolved stash conflicts\");\n                    }\n                    return Ok(());","sourceCodeStart":5205,"sourceCodeEnd":5241,"githubUrl":"https://github.com/nikivdev/code/blob/a747e741ae92c09071d0ae946ab48488adcff1ce/src/sync.rs#L5205-L5241","documentation":"Same auto-stash restore failure as the packet variant, but no repair packet path was available, so the message only suggests manual `git stash list` recovery. It signals that sync finished its transfer but your pre-sync local changes could not be reapplied.","triggerScenarios":"Stash pop/apply failed during `restore_stash` and `repair_packet_path` was None (no repair packet was created or it failed to produce a path).","commonSituations":"Stash conflicts after a remote sync; local untracked files colliding with stashed ones; a previous aborted sync left the repo dirty.","solutions":["Run `git stash list` to find the auto-stash entry","`git stash apply stash@{0}`, resolve any conflicts, then `git stash drop`","Check `git status` for mid-merge state and resolve before re-running sync"],"exampleFix":"git stash apply stash@{0}\n# resolve conflicts\ngit add -A\ngit stash drop stash@{0}","handlingStrategy":"fallback","validationCode":"git stash list && git status --porcelain  # clean tree, no pending auto-stash","typeGuard":null,"tryCatchPattern":"match sync_result {\n    Err(e) if e.to_string().contains(\"failed to restore sync auto-stash\") => {\n        let _ = run(\"git\", &[\"stash\", \"apply\", \"stash@{0}\"]);\n        // resolve conflicts, then git stash drop\n    }\n    r => r?,\n}","preventionTips":["Start sync from a clean worktree","Resolve any mid-merge state (`git status`) before syncing","Do not interrupt a running sync","Use the packet-producing path when available for easier recovery"],"tags":["git","stash","sync"],"backgroundTag":"git-stash-restore-failed","analyzedSha":"a747e741ae92c09071d0ae946ab48488adcff1ce","analyzedAt":"2026-09-01T22:43:55.719Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}