TanStack Errors

Implement TanStack Query error handling patterns in React apps.

7|2|Updated Jan 9, 2026
One-click install
npx skills add https://github.com/salmanrrana/brain-dump --skill tanstack-errors
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: TanStack Errors
Source: https://github.com/salmanrrana/brain-dump/tree/main/.claude/skills/tanstack-errors
Command: npx skills add https://github.com/salmanrrana/brain-dump --skill tanstack-errors

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

TanStack Query error handling can be complex and error-prone; this skill provides structured guidance to implement consistent strategies across local components, boundaries, and global layers.

Core Features & Use Cases

  • Local error handling: manage per-component errors with isError, error boundaries, and throwOnError strategies.
  • Error Boundaries: centralize critical failures to show user-friendly fallbacks.
  • Global error handling: central onError callbacks via QueryClient and MutationCache to avoid duplicate alerts.
  • Use cases: handle 4xx/5xx responses, network issues, and failed retries with clear UX patterns.

Quick Start

Explain and apply best-practice TanStack Query error-handling patterns in your React app to handle local, boundary, and global errors.

Frequently Asked Questions about TanStack Errors

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

FAQPage Schema
How do I handle TanStack Query errors globally to avoid duplicate alerts in React?

Global TanStack Query error handling uses central onError callbacks configured in QueryClient and MutationCache to intercept failures and display a single user alert. This avoids duplicate notifications across components.

What's the best way to manage local React Query error states per component?

Local React Query error states are managed per component using the isError flag and error object. You can render inline fallbacks directly in components for non-critical 4xx failures without interrupting the entire UI.

When should I use error boundaries with TanStack Query instead of local error handling?

Use error boundaries with TanStack Query for critical 5xx failures or network issues that require replacing the entire UI section. The throwOnError strategy catches these errors centrally to show user-friendly fallbacks.

How do retry patterns work when handling network failures in React Query?

Retry patterns in React Query automatically reattempt failed network requests before surfacing errors. You can configure retry counts and delays to handle transient network issues, then trigger local or global error handling if retries fail.

Does TanStack Query error handling work for both 4xx and 5xx HTTP responses?

Yes, TanStack Query error handling supports both 4xx and 5xx HTTP responses. You can route 4xx errors to local component states for inline messages and 5xx server errors to error boundaries for centralized fallbacks.