The documentation should mention that there is a limit to the maximum length of StorageProviderSyncRootInfo::Id. Deep inside the Register function is this code:
StringCchPrintfW(
DestBuffer,
260,
L"%s\\%s\\CustomStates\\%d",
L"Software\Microsoft\Windows\CurrentVersion\Explorer\SyncRootManager",
L"... StorageProviderSyncRootInfo::Id ...",
1);
When the ID is longer than 174 characters the function fails with mentioned error and leaves "semi-registered" storage provider that cannot be easily unregistered.