{"record":{"id":"a50b07bfa3ebf0cc","repo":"OrchardCMS/OrchardCore","slug":"the-shape-type-shapemetadata-type-is-not-found-for-the-theme","errorCode":null,"errorMessage":"The shape type '{shapeMetadata.Type}' is not found for the theme '{theme?.Id}'","messagePattern":"The shape type '(.+?)' is not found for the theme '(.+?)'","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/OrchardCore/OrchardCore.DisplayManagement/Implementation/DefaultHtmlDisplay.cs","lineNumber":131,"sourceCode":"            {\n                shapeMetadata.ChildContent = displayContext.ChildContent;\n            }\n\n            if (shapeMetadata.ChildContent == null)\n            {\n                // There might be no shape binding for the main shape, and only for its alternates.\n                if (shapeDescriptor != null)\n                {\n                    await shapeDescriptor.ProcessingAsync.InvokeAsync((action, displayContext) => action(displayContext), displayContext, _logger);\n                }\n\n                // Now find the actual binding to render, taking alternates into account.\n                actualBinding = await GetShapeBindingAsync(shapeMetadata.Type, shapeMetadata.Alternates, shapeTable);\n\n                if (actualBinding == null)\n                {\n                    var theme = await _themeManager.GetThemeAsync();\n                    throw new InvalidOperationException($\"The shape type '{shapeMetadata.Type}' is not found for the theme '{theme?.Id}'\");\n                }\n\n                await shapeMetadata.ProcessingAsync.InvokeAsync((action, displayContext) => action(displayContext.Shape), displayContext, _logger);\n\n                shapeMetadata.ChildContent = await ProcessAsync(actualBinding, shape, localContext);\n            }\n\n            // Process wrappers.\n            if (shapeMetadata.Wrappers.Count > 0)\n            {\n                foreach (var frameType in shapeMetadata.Wrappers)\n                {\n                    var frameBinding = await GetShapeBindingAsync(frameType, AlternatesCollection.Empty, shapeTable);\n                    if (frameBinding != null)\n                    {\n                        wrapperBindings ??= [];\n                        wrapperBindings.Add(frameBinding);\n                        shapeMetadata.ChildContent = await ProcessAsync(frameBinding, shape, localContext);","sourceCodeStart":113,"sourceCodeEnd":149,"githubUrl":"https://github.com/OrchardCMS/OrchardCore/blob/4306c0717fe573f6fca1b4955909ddab6a192807/src/OrchardCore/OrchardCore.DisplayManagement/Implementation/DefaultHtmlDisplay.cs#L113-L149","documentation":"DefaultHtmlDisplay.ExecuteAsync resolves a shape rendering binding from the shape table, including alternates. When no binding exists for the shape type (and its alternates) in the current theme, it throws InvalidOperationException naming the shape type and current theme id. It means the requested shape is not defined by any active module/theme binding.","triggerScenarios":"Rendering a shape type that no module or the active theme defines — e.g., ShapeFactory display of \"MyWidget\" with no ShapeBinding; an alternate name that matches nothing and no base binding fallback; a theme overriding/renaming a shape template while code still requests the old type.","commonSituations":"Renaming a .cshtml template (e.g., PartsFoo.cshtml -> Parts_Foo.cshtml) without updating code referencing the shape; disabling a feature that provided the shape; typos in shape type strings or alternates; theme switched to one that lacks custom shapes other code depends on.","solutions":["Verify a template or shape binding exists for the shape type (a razor view named after the shape, e.g., Views/Parts-Foo.cshtml) in the active theme or an enabled module.","Check the shape type spelling and any alternates passed to the factory/display call.","Re-enable the module/theme feature that supplies the missing shape binding.","Inspect the shape table at runtime (debug logging in DefaultHtmlDisplay) to see which bindings the current theme exposes."],"exampleFix":"// before\nawait shapeFactory.DisplayAsync(await shapeFactory.CreateAsync(\"Parts_Widgit\")); // typo\n// after\nawait shapeFactory.DisplayAsync(await shapeFactory.CreateAsync(\"Parts_Widget\"));","handlingStrategy":"try-catch","validationCode":"if (!shapeTable.Descriptors.ContainsKey(\"Parts_Widget\"))\n    logger.LogWarning(\"Shape type {Type} has no binding for theme {Theme}\", \"Parts_Widget\", themeId);","typeGuard":null,"tryCatchPattern":"catch (InvalidOperationException ex) when (ex.Message.Contains(\"is not found for the theme\"))\n{\n    logger.LogError(ex, \"Missing shape binding; check templates and enabled features\");\n    return Content(string.Empty); // graceful degradation\n}","preventionTips":["Keep shape template names in sync with shape type strings","After renaming views, grep code for old shape names","Verify alternates always resolve to an existing base binding","Check enabled features after deployments to themed environments"],"tags":["shapes","theming","rendering"],"backgroundTag":"resource-not-found","analyzedSha":"4306c0717fe573f6fca1b4955909ddab6a192807","analyzedAt":"2026-09-13T17:41:05.024Z","contentChangedAt":"2026-09-13T17:41:05.024Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}