Fixing "Error renaming ... while normalizing UTF8 encoding" in Syncthing on macOS
Problem Description
At first, I noticed that many files on my Mac would automatically gain a .temp suffix — even after I manually renamed them back to their original names, the .temp extension would soon reappear.
This behavior happened repeatedly and seriously affected normal use.
After checking the Syncthing control panel, I found multiple error messages such as:
Error renaming "... .ipynb.tmp" to "... .ipynb" while normalizing UTF8 encoding: file does not exist. You will want to rename this file back manually.
This indicated that Syncthing attempted to rename temporary .tmp files created during UTF-8 filename normalization but failed to do so, leaving the .tmp files behind and generating warnings.
The issue mainly occurred in project folders containing files with:
- Japanese characters (日本語ファイル名)
- Spaces
- Very long paths
These conditions often lead to encoding inconsistencies on macOS file systems, which caused Syncthing to mis-handle file renaming operations.
🔍 Root Cause
Syncthing automatically performs UTF-8 normalization when syncing files between systems that use different Unicode formats.
- macOS uses NFD (Normalization Form D)
- Windows and Linux use NFC (Normalization Form C)
When Syncthing detects a filename that needs “normalization,” it:
- Creates a temporary file like filename.ext.tmp
- Tries to rename it back to the normalized version
However, on macOS this often fails because:
- The file is being indexed by Finder or iCloud Drive
- The system’s Unicode normalization conflicts with Syncthing’s
- The filename is too long or contains special characters
Hence the log:
Error renaming ... while normalizing UTF8 encoding: file does not exist