dotnet/aspnetcore · error · InvalidOperationException

The Router component requires a value for the parameter Foun

Error message

The Router component requires a value for the parameter Found.

What it means

Thrown in Router.SetParametersAsync. Found ([EditorRequired]) is the RenderFragment<RouteData> rendered when a route matches — the Router cannot proceed without it because there is no safe default for how to display a matched page (callers need to customize it, e.g., to add authorization via AuthorizeRouteView). A null Found aborts startup.

Source

Thrown at src/Components/Components/src/Routing/Router.cs:135

        }
    }

    /// <inheritdoc />
    public async Task SetParametersAsync(ParameterView parameters)
    {
        parameters.SetParameterProperties(this);

        if (AppAssembly == null)
        {
            throw new InvalidOperationException($"The {nameof(Router)} component requires a value for the parameter {nameof(AppAssembly)}.");
        }

        // Found content is mandatory, because even though we could use something like <RouteView ...> as a
        // reasonable default, if it's not declared explicitly in the template then people will have no way
        // to discover how to customize this (e.g., to add authorization).
        if (Found == null)
        {
            throw new InvalidOperationException($"The {nameof(Router)} component requires a value for the parameter {nameof(Found)}.");
        }

        if (NotFoundPage != null)
        {
#pragma warning disable CS0618 // Type or member is obsolete
            if (NotFound != null)
            {
                throw new InvalidOperationException($"Setting {nameof(NotFound)} and {nameof(NotFoundPage)} properties simultaneously is not supported. Use either {nameof(NotFound)} or {nameof(NotFoundPage)}.");
            }
#pragma warning restore CS0618 // Type or member is obsolete
            if (!typeof(IComponent).IsAssignableFrom(NotFoundPage))
            {
                throw new InvalidOperationException($"The type {NotFoundPage.FullName} " +
                    $"does not implement {typeof(IComponent).FullName}.");
            }

            var routeAttributes = NotFoundPage.GetCustomAttributes(typeof(RouteAttribute), inherit: true);
            if (routeAttributes.Length == 0)

View on GitHub (pinned to 294cab2f9b)

Solutions

  1. Add a <Found Context="routeData"> template containing <RouteView RouteData="@routeData" DefaultLayout="..." />.
  2. For authorized pages, use <AuthorizeRouteView RouteData="@routeData" .../> inside Found.
  3. Confirm the Found parameter is bound and not null before the Router renders.

Example fix

<!-- before -->
<Router AppAssembly="@typeof(Program).Assembly">
</Router>

<!-- after -->
<Router AppAssembly="@typeof(Program).Assembly">
    <Found Context="routeData">
        <RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
    </Found>
</Router>
Defensive patterns

Strategy: validation

Validate before calling

// Provide a <Found> template; the [EditorRequired] nature means it must be set.
<Router AppAssembly="@typeof(Program).Assembly">
    <Found Context="routeData">
        <RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
        <FocusOnNavigate RoutePath="@routeData.PageType.FullName" />
    </Found>
</Router>

Prevention

When it happens

Trigger: Rendering <Router> without a <Found> child template. The Found template is normally where <RouteView> (or <AuthorizeRouteView>) is placed.

Common situations: A partially-written App.razor missing the <Found> block; refactoring that removed Found while tweaking layout; a templating mistake where Found was renamed.

Related errors


AI-assisted analysis of dotnet/aspnetcore@294cab2f9b (2026-08-06). Data as JSON: /api/errors/56144aa304e9c9a2. Report an issue: GitHub.