Migrating media libraries to the content hub gives an error

2025/09/23 10:38 AM

Migrating media libraries to the content hub with the 'MigrateMediaLibrariesToContentHubTask' gives an error:

Message: 'name' is not a valid code name. (Parameter 'name')

Exception type: System.ArgumentException
Stack trace:
at CMS.ContentEngine.CreateContentFolderParameters..ctor(String displayName, String name)
at CMS.MediaLibrary.MediaFolderMigrationService.CreateFolder(String name, String displayName, Int32 parentFolderId, IContentFolderManager contentFolderManager, Nullable`1 guid, CancellationToken cancellationToken)
at CMS.MediaLibrary.MediaFolderMigrationService.RecursivelyEnsureSubfoldersStructure(MediaLibraryInfo mediaLibraryInfo, ContentFolderInfo parentFolder, String parentAssetFolderPath, IContentFolderManager contentFolderManager, IDictionary`2 folderPaths, CancellationToken cancellationToken)
at CMS.MediaLibrary.MediaFolderMigrationService.EnsureSubfoldersStructure(Dictionary`2 defaultFolders, IContentFolderManager contentFolderManager, CancellationToken cancellationToken)
at CMS.MediaLibrary.MediaFolderMigrationService.EnsureFolderStructure(Int32 userId, WorkspaceInfo workspace, CancellationToken cancellationToken)
at CMS.MediaLibrary.Internal.MigrateMediaLibrariesToContentHubTask.MigrateToContentHub(Int32 userId, CancellationToken cancellationToken)
at CMS.MediaLibrary.Internal.MigrateMediaLibrariesToContentHubTask.Execute(ScheduledTaskConfigurationInfo task, CancellationToken cancellationToken)

I already tried renaming the media library names, but I can't yet seem to find why this isn't working. Is there anyone who has already tried this functionality and has had it working?


Environment

  • Xperience by Kentico version: 30.8.2

  • .NET version: 9

Tags:
Content hub Media Library Migration / upgrade

Answers

2025/09/23 10:48 AM
Accepted answer

Looks like it has to do something with a space in the folder name. For example the 'product brochures' subfolder is renamed with the 'GetUniqueMigrationCodename' method to: 'product brochures.migration.6'.

I did submit a support ticket for this matter, will keep this post updated.

2025/11/21 5:32 AM

Hi @ArjanvanHugten, did you get a response from Kentico on this particular issue?

2025/11/25 10:33 AM

@benquinlan yes, I had contact with Kentico support.

The issue was being caused by the migration toolkit not using the new naming convention that is required. I made the following GitHub issue for it: https://github.com/Kentico/xperience-by-kentico-kentico-migration-tool/issues/515 and it has been completed recently.

If you currently have already migrated data, then I wouldn't know what would be best to fix it. For my solution I already migrated the media files to the content hub with the migration toolkit so that I didn't have to do the migration in the media library itself.

To response this discussion, you have to login first.