How to fix Recorded preimage for 'file.txt' but resolution failed in Git

GitINTERMEDIATEMEDIUMUpdated Dec 2, 2025ยท 146 views

Git rerere (reuse recorded resolution) failed to automatically apply a previously recorded conflict resolution. This happens when the cached resolution no longer matches the current conflict context.

Quick fix

Fixes Recorded preimage for 'file.txt' but resolution failed

git rerere status
  1. Check which files have failed rerere resolution
  2. Manually resolve the conflict
  3. Forget the bad cached resolution
  4. Continue the merge or rebase operation
git โ€” error
git rerere status
Recorded preimage for 'file.txt' but resolution failed

What this error means

Git rerere is a feature that records how you resolve merge conflicts and automatically reuses those resolutions when the same conflict appears again. The 'resolution failed' error occurs when rerere finds a matching conflict fingerprint in its cache (.git/rr-cache), but the three-way merge between the earlier conflict, the recorded resolution, and the current conflict cannot be applied cleanly. This typically happens because the code context has changed significantly since the original resolution was recorded, or the conflict structure has evolved in ways that make the cached resolution incompatible. Git tries to help by replaying your previous fix, but when the replay fails, it falls back to showing you the original conflict markers. Unlike a simple merge conflict, this error indicates that Git attempted to help using rerere but encountered an inconsistency between what was recorded and what currently exists in your working tree.

Typical symptoms

  • Message: 'Recorded preimage for FILE but resolution failed'
  • Message: 'Resolved FILE using previous resolution'
  • Merge conflict markers still appear in files after rerere attempts resolution
  • git rerere status shows files that could not be auto-resolved
  • git rerere remaining lists paths with unresolved conflicts
  • Rebase or merge operations pause with conflicts despite rerere being enabled

Common causes

  1. Code context around the conflict has changed significantly since the original resolution
  2. Conflict markers in the file that look like actual code confuse rerere fingerprinting
  3. Unmatched or improperly nested conflict markers prevent rerere from tracking the conflict
  4. Conflicting submodules, which rerere cannot track or resolve automatically
  5. Corrupt or incomplete entries in the .git/rr-cache directory
  6. Different conflict structure between original and current merge (e.g., different number of conflict hunks)
  7. Modified files during a rebase sequence that change the conflict context

How to fix "Recorded preimage for 'file.txt' but resolution failed"

1Check which files have failed rerere resolution

Use git rerere to see the status of recorded resolutions:

bash
git rerere status

To see which conflicts still need manual resolution:

bash
git rerere remaining

This shows files that rerere couldn't resolve, including submodules and files with tracking issues.

2Manually resolve the conflict

Open the conflicted file and resolve it manually as you would any merge conflict:

1. Look for conflict markers: <<<<<<<, =======, >>>>>>>
2. Edit the file to resolve the conflict
3. Remove all conflict markers
4. Save the file

After resolving, stage the file:

bash
git add <file>

Git will record this new resolution for future use.

3Forget the bad cached resolution

If rerere keeps applying an incorrect resolution, remove it from the cache:

bash
git rerere forget <file>

Note: You must apply the bad resolution first (by doing the merge), THEN forget it, THEN reset and redo the merge:

bash
# After merge applies bad resolution
git rerere forget <file>
git reset --hard origin/<branch>
# Now redo the merge and resolve correctly

To clear all rerere cache completely:

bash
rm -rf .git/rr-cache
4Continue the merge or rebase operation

After resolving conflicts and staging files, continue your operation:

For rebase:

bash
git rebase --continue

For merge:

bash
git commit

For cherry-pick:

bash
git cherry-pick --continue

Git will now record the new resolution in rerere cache for future conflicts.

5Verify the resolution with testing

Always verify that rerere-assisted resolutions are correct:

bash
# Review the changes
git diff

# Run your tests
npm test  # or your test command

Note: git rerere leaves the index file alone and doesn't automatically stage files. You must always inspect results and run tests before committing.

Advanced notes

Git rerere works by taking a fingerprint of conflicts and pairing them with fix fingerprints. The cache is stored in .git/rr-cache/, where each conflict gets a directory with 'preimage' (conflict state), 'postimage' (resolved state), and 'thisimage' files.

Conflict Marker Issues: If your code contains lines that look like conflict markers (e.g., documentation examples showing <<<<<<< or =======), rerere may fail. Use the conflict-marker-size setting in .gitattributes to work around this: 'file.txt conflict-marker-size=32'.

Garbage Collection: By default, unresolved conflicts older than 15 days and resolved conflicts older than 60 days are pruned via 'gc.rerereUnresolved' and 'gc.rerereResolved' config variables.

Sharing Rerere Cache: Teams can share rerere resolutions via a dedicated branch in the repository, or use 'rerere-train.sh' to learn resolutions from existing Git history. This helps team members automatically benefit from conflict resolutions made by others.

Long-lived Feature Branches: A key use case for rerere is maintaining long-lived topic branches. You can periodically attempt merges with the main branch, resolve conflicts, then back out (git reset --hard). When the final merge happens, rerere will apply all previously recorded resolutions automatically.

Frequently asked questions

What does "Recorded preimage for 'file.txt' but resolution failed" mean?
Git rerere is a feature that records how you resolve merge conflicts and automatically reuses those resolutions when the same conflict appears again. git/rr-cache), but the three-way merge between the earlier conflict, the recorded resolution, and the current conflict cannot be applied cleanly. This typically happens because the code context has changed significantly since the original resolution was recorded, or the conflict structure has evolved in ways that make the cached resolution incompatible.
How do I fix "Recorded preimage for 'file.txt' but resolution failed"?
Git rerere (reuse recorded resolution) failed to automatically apply a previously recorded conflict resolution. This happens when the cached resolution no longer matches the current conflict context.
What causes "Recorded preimage for 'file.txt' but resolution failed"?
Code context around the conflict has changed significantly since the original resolution Conflict markers in the file that look like actual code confuse rerere fingerprinting Unmatched or improperly nested conflict markers prevent rerere from tracking the conflict
Is the "Recorded preimage for 'file.txt' but resolution failed" error serious?
It is a medium-severity error โ€” more of a blocker than a risk. The steps above resolve it.

Official resources & further reading