OrchardCMS/OrchardCore · error · ArgumentException
render_section tag requires a name argument
Error message
render_section tag requires a name argument
What it means
The Liquid `render_section` tag needs a `name` argument identifying which layout zone to render (e.g. Navigation, Content, Footer). The name is looked up as the first positional argument or a named `name:`; when both are absent the tag throws an ArgumentException because it has no zone to resolve on the layout shape.
Solutions
- Provide the zone name positionally: `{% render_section 'Footer' %}`.
- Or name it explicitly: `{% render_section name:'Footer', required:false %}`.
- Verify the layout shape actually defines a zone with that name (see also the 'Zone not found' error for the required case).
Example fix
// before
{% render_section required:true %}
// after
{% render_section name:'Footer', required:true %} Defensive patterns
Strategy: validation
Validate before calling
{% if section_name == blank %}{% // render_section requires a name argument %}{% else %}{% render_section section_name %}{% endif %} Prevention
- Pass the zone name as the first positional argument or `name:'...'`.
- Only use `required:true` when the zone is guaranteed to be populated.
- Keep a list of valid layout zone names for template authors.
When it happens
Trigger: `{% render_section %}` with no arguments at all, or only unrelated named arguments such as `{% render_section required:true %}` (no `name` / first positional value).
Common situations: Template scaffolds with the zone name left as a TODO placeholder; refactoring that removed the literal name; dynamic zone names passed as a null variable.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- page_title tag requires a segment argument
- Cannot override href with other properties
- Format of the link cannot be determined based on the…
- Zone not found while invoking 'render_section':
- An implementation of 'LiquidTemplateContext' is required
AI-assisted analysis of OrchardCMS/OrchardCore@4306c0717f (2026-09-13).
Data as JSON: /api/errors/f3e508b94b83c0a1.
Report an issue: GitHub.
Appendix: source
Thrown at src/OrchardCore/OrchardCore.DisplayManagement.Liquid/Tags/RenderSectionTag.cs:21
using Fluid.Ast;
using Microsoft.Extensions.DependencyInjection;
using OrchardCore.DisplayManagement.Layout;
using OrchardCore.Liquid;
namespace OrchardCore.DisplayManagement.Liquid.Tags;
public class RenderSectionTag
{
public static async ValueTask<Completion> WriteToAsync(IReadOnlyList<FilterArgument> argumentsList, TextWriter writer, TextEncoder encoder, TemplateContext context)
{
var services = ((LiquidTemplateContext)context).Services;
var layout = await services.GetRequiredService<ILayoutAccessor>().GetLayoutAsync();
var displayHelper = services.GetRequiredService<IDisplayHelper>();
var arguments = new NamedExpressionList(argumentsList);
var nameExpression = arguments["name", 0] ?? throw new ArgumentException("render_section tag requires a name argument");
var name = (await nameExpression.EvaluateAsync(context)).ToStringValue();
var requiredExpression = arguments["required", 1];
var required = requiredExpression != null && (await requiredExpression.EvaluateAsync(context)).ToBooleanValue();
var zone = layout.Zones[name];
if (zone.IsNullOrEmpty())
{
if (required)
{
throw new InvalidOperationException("Zone not found while invoking 'render_section': " + name);
}
return Completion.Normal;
}
var htmlContent = await displayHelper.ShapeExecuteAsync(zone);View on GitHub (pinned to 4306c0717f)