Are You Getting “Key Does Not Exist In This Pattern Space” Error?

This post is related to my previous post where I illustrated how to deal with persona and pattern card programmatically. If you are working on such stuff and found below mentioned error in log, then this post may help you to understand why it is happening and how to get rid of this error.

Message: Key ‘Network Infrastructure’ does not exist in this pattern space

Source: Sitecore.Analytics

   at Sitecore.Analytics.Patterns.PatternSpace.GetKeyIndex(String key)

   at Sitecore.Analytics.Patterns.PercentagePatternMapper.GetPoints(PatternSpace space, IProfileData values)

   at Sitecore.Analytics.Patterns.PatternSpace.CreatePattern(IProfileData profile)

   at System.Linq.Enumerable.<>c__DisplayClass2`3.<CombineSelectors>b__3(TSource x)

   at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()

   at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source)

   at Sitecore.Analytics.Data.Items.ProfileItem.get_MappedPatterns()

   at Sitecore.Analytics.Data.Items.ProfileItem.MatchPattern(IProfileData profile, IPatternDistance distance)

   at Sitecore.Analytics.Tracking.Profile.UpdatePattern()


Whenever we call profile.UpdatePattern(), Sitecore is updating all profile keys of that profile using profile key item field name instead of profile key item name.

While Sitecore is storing profile item name as key in Pattern XML field.

How to get rid of this error?

Change name to Network and Infrastructure from Network Infrastructure then it will NOT complain above error.

That’s it. Have a learning Sitecore Journey!

Leave a Reply