I have written a program to create Catalog, followed by its category and then tried to create a Relationship(CatalogToCategory) through CreateRelationshipCommand. Im getting the below error.

[17:07:12 ERR] PipelineAbort:Entity not found for Source:Entity-Catalog-CatalogName, Target:Entity-Category-CatalogName-CategoryName, Relationship type:CatalogToCategory

My code below:

Code for creating catalog:

using (CommandActivity.Start(context.CommerceContext, 
                     catalog = await 
                                        item.Name, item.DisplayName);
                        if (catalog != null)
                            CreateCategories(catalog, item, context);

code for creating categories:

foreach (var _category in item.Categories)
       Category category = null;
       using (CommandActivity.Start(context.CommerceContext, 
             category = await 
                 catalog.Id, _category, _category, string.Empty);
          var relationShip = CreateRelationship(context, catalog, category);

code for creating relationship:

var relation = createRelationshipCommand.
                      catalog.Id, //Entity-Catalog-CatalogName

code for creating relationship(Using associateCategoryToParentCommand):

 var association = await associateCategoryToParentCommand.Process(context.CommerceContext,
                        catalog.Id, catalog.Id, category.Id).ConfigureAwait(true);

Got the same error when using "AssociateCategoryToParentCommand" instead of "CreateRelationshipCommand". Please find the error message below.

enter image description here

Is there anything I'm missing out here? Should I run any other command before/after this? Am I using the right parameters?

Both the items(catalog and category) are created in the database. Also, the catalog created is visible in BizFx tool. But the category created is not.

Is there any simple way to map catalog to categories, categories to sellable items and to show them in BizFx tool through code.

Im using Sitecore Commerce 9.2 version.

  • try AssociateCategoryToParentCommand instead of CreateRelationshipCommand. Commented Dec 26, 2019 at 9:03
  • Hi @VipinBanka, thanks for your reply. Still getting that same error message when using "AssociateCategoryToParentCommand". Am I providing the right parameters? var relation = await associateCategoryToParentCommand.Process(context.CommerceContext, catalog.Id, catalog.Id, category.Id).ConfigureAwait(true); Commented Dec 26, 2019 at 15:32
  • Hi @VipinBanka, yes you are right. "AssociateCategoryToParentCommand" works for me. The mistake I did was, forgot to Initialize the environment which I newly created. Thanks for your help. Commented Dec 27, 2019 at 1:13

1 Answer 1


Looks like your commerce engine was not initialized properly.

You have to reinitialize it.

Steps you can find here: https://doc.sitecore.com/en/developers/90/sitecore-experience-commerce/clean-and-initialize-the-environment.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.