David Peterson bio photo

David Peterson

David is a Sitecore Architect with ATP World Tour, founder of the Philadelphia Sitecore Users Group and Technical Sitecore MVP. Often reminiscing of his days as a Sysop and being Elite.

Email Twitter LinkedIn Github

We recently ran into a scenario where items imported from an external source weren’t making their way into Sitecore. A failure was recorded during item creation of the bucketable item. The items destination is a bucket, which organizes the bucket folders using the default bucket folder path based on date and time of the item’s creation.

The following is the error which was recorded in the logs:

An item name must satisfy the pattern: ^[\w\\$][\w\s\-\$](\(\d{1,}\)){0,1}

A look inside the buckets provider provided direct insight to the root cause of the issue. The default provider (Sitecore 8.1u3), is defined as:

<bucketManager defaultProvider="default" enabled="true" patch:source="Sitecore.Buckets.config">
		<add name="default" type="Sitecore.Buckets.Managers.PipelineBasedBucketProvider, Sitecore.Buckets"/>

Overriding the default bucket folder naming convention using the item name created an opportunity for error where the item name failed validation for creation of its parent bucket folder items.

By default, Sitecore uses date/time to determine bucket folders

<setting name="BucketConfiguration.BucketFolderPath" value="yyyy\/MM\/dd\/HH\/mm" patch:source="Sitecore.Buckets.config"/>

Using Sitecore’s item bucket settings (/sitecore/system/Settings/Buckets/Item Buckets Settings), we were overriding the folder naming convention using the first two characters of the item’s name.

buckets rules

Conversion of the item name to replace spaces with hypens during the import process ensured proper item naming standards, however, failed to create buckets folders in which an item contained a space in the second position. This resulted in an attempt to create a bucket parent folder of “-“, which is invalid and generates an exception during item creation.