{"record":{"id":"59f900a4ecad76e5","repo":"OrchardCMS/OrchardCore","slug":"zone-not-found-while-invoking-render-section","errorCode":null,"errorMessage":"Zone not found while invoking 'render_section': ","messagePattern":"Zone not found while invoking 'render_section': ","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/OrchardCore/OrchardCore.DisplayManagement.Liquid/Tags/RenderSectionTag.cs","lineNumber":33,"sourceCode":"\n        var layout = await services.GetRequiredService<ILayoutAccessor>().GetLayoutAsync();\n        var displayHelper = services.GetRequiredService<IDisplayHelper>();\n\n        var arguments = new NamedExpressionList(argumentsList);\n\n        var nameExpression = arguments[\"name\", 0] ?? throw new ArgumentException(\"render_section tag requires a name argument\");\n        var name = (await nameExpression.EvaluateAsync(context)).ToStringValue();\n\n        var requiredExpression = arguments[\"required\", 1];\n        var required = requiredExpression != null && (await requiredExpression.EvaluateAsync(context)).ToBooleanValue();\n\n        var zone = layout.Zones[name];\n\n        if (zone.IsNullOrEmpty())\n        {\n            if (required)\n            {\n                throw new InvalidOperationException(\"Zone not found while invoking 'render_section': \" + name);\n            }\n\n            return Completion.Normal;\n        }\n\n        var htmlContent = await displayHelper.ShapeExecuteAsync(zone);\n        htmlContent.WriteTo(writer, (HtmlEncoder)encoder);\n\n        return Completion.Normal;\n    }\n}\n","sourceCodeStart":15,"sourceCodeEnd":45,"githubUrl":"https://github.com/OrchardCMS/OrchardCore/blob/4306c0717fe573f6fca1b4955909ddab6a192807/src/OrchardCore/OrchardCore.DisplayManagement.Liquid/Tags/RenderSectionTag.cs#L15-L45","documentation":"`render_section` resolved the zone name on the layout, but the zone shape is null or empty. When the tag was invoked with `required:true`, the absence of the zone is treated as a template error and this InvalidOperationException is thrown; otherwise the tag silently renders nothing. It signals that the layout does not contain content for the named zone.","triggerScenarios":"`{% render_section name:'SomeZone', required:true %}` where `layout.Zones['SomeZone']` is null or empty — typically a zone no theme/layout ever populated.","commonSituations":"Copying a template between themes where the target theme never fills that zone; typos in the zone name ('Footter', 'Footer '); custom layouts that removed a zone still referenced by alternates; expecting a zone to exist only when a particular module/feature is enabled.","solutions":["Check the zone name spelling against the layout definition (zones are typically lowercase in Liquid, e.g. 'footer').","Set `required:false` (or omit it) if rendering the section is optional and an empty zone is acceptable.","Ensure something actually populates the zone (theme layout, placement, or a module adding shapes to it)."],"exampleFix":"// before\n{% render_section 'AsideSecond', required:true %}\n// after\n{% render_section 'AsideSecond', required:false %}","handlingStrategy":"fallback","validationCode":"{% assign zone = layout.zones[section_name] %}{% if zone == blank %}{% // zone missing: skip or render default %}{% endif %}","typeGuard":null,"tryCatchPattern":"try { await displayHelper.ShapeExecuteAsync(zone); } catch (InvalidOperationException ex) when (ex.Message.StartsWith(\"Zone not found\")) { /* render nothing or fallback markup */ }","preventionTips":["Verify zone names against the active theme's layout before marking sections required.","Use required:false for optional zones and provide default markup when empty.","Check that the module/feature that populates the zone is enabled."],"tags":["liquid","razor-tags","zone-not-found","layout","orchardcore"],"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"}