When mega-sync fails with the following message:
Failed to sync folder: Invalid argument. Unable to retrieve the ID of current device
the problem is often not the sync path itself. In my case, the real issue was that the Ubuntu environment deployed inside Docker did not have a valid machine ID.
Why This Happens
MEGA relies on the current device ID when creating or managing sync relationships. On some minimal Ubuntu container images, /etc/machine-id can be missing or empty. When that happens, mega-sync cannot identify the current device correctly and returns the misleading Invalid argument error.
Fix
Generate a machine ID and write it to /etc/machine-id:
dbus-uuidgen > /etc/machine-id
After that, run the mega-sync command again. In this case, the sync operation should work normally.
Notes
- This issue is commonly seen in Docker-based Ubuntu deployments.
- You may need root privileges to write to
/etc/machine-id. - If the file already exists, check whether it is empty before overwriting it.
Reference
The solution was based on the discussion in the MEGAcmd issue tracker: