router-core/not-found-and-errors

Coordinate not-found and error boundaries for TanStack Router routes.

6|1|Updated Jun 1, 2025
One-click install
npx skills add https://github.com/rezics/rezics --skill router-core-not-found-and-errors-rezics
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: router-core/not-found-and-errors
Source: https://github.com/rezics/rezics/tree/main/.agents/skills/tanstack/router/router-core/not-found-and-errors
Command: npx skills add https://github.com/rezics/rezics --skill router-core-not-found-and-errors-rezics

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

The Not Found and Errors skill provides guidance on handling not-found scenarios, global and per-route error boundaries, and how to route errors and not-found cases in TanStack Router. It clarifies when to use notFound(), notFoundComponent, defaultNotFoundComponent, notFoundMode, and errorComponent, along with masking and route targeting.

Core Features & Use Cases

  • Global and per-route not-found handling with notFound() and notFoundComponent
  • Configurable notFoundMode and defaultNotFoundComponent usage
  • Per-route errorComponent with error handling and retry via router.invalidate()
  • Data considerations in notFoundComponent, and route masking features for URL masking
  • Guidance for targeting specific routes with notFound({ routeId }) and rootRouteId

Quick Start

Create a route that throws notFound() when a resource is missing and implement a per-route notFoundComponent to render the fallback UI.

Frequently Asked Questions about router-core/not-found-and-errors

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I handle not-found pages in TanStack Router?

Handle not-found pages in TanStack Router by throwing the notFound() function in a route loader and rendering a fallback UI via notFoundComponent, with configurable notFoundMode for global or per-route behavior.

What's the difference between notFound() and errorComponent in TanStack Router?

notFound() triggers a dedicated not-found UI through notFoundComponent when a resource is missing, while errorComponent catches unexpected runtime errors and supports recovery via router.invalidate() for retrying failed data fetching.

Can I configure a global 404 fallback for nested route trees in TanStack Router?

Yes, you can configure a global not-found fallback for nested route trees in TanStack Router using defaultNotFoundComponent and notFoundMode, or target specific routes with notFound({ routeId }) and rootRouteId.

How do I display safe data inside a TanStack Router notFoundComponent?

Display safe data inside a TanStack Router notFoundComponent by ensuring the component only accesses data already resolved by the parent route's loader, satisfying frontmatter metadata requirements for safe data usage.

Does TanStack Router support route masking for not-found scenarios?

Yes, TanStack Router supports route masking for not-found scenarios, allowing URL masking to hide internal route paths while rendering a notFoundComponent or errorComponent for the targeted layout.

Why is my per-route errorComponent not catching errors in TanStack Router layouts?

A per-route errorComponent might not catch errors in TanStack Router layouts if the error boundary is not properly orchestrated across the nested route tree, requiring correct errorComponent placement alongside router.invalidate() for retry logic.