# Next.js: Error: Route /blog used "revalidatePath /blog" during render which is unsupported. It must happen outside of renders and cached functions

**Code:** `Route used revalidatePath during render` · **Category:** Next.js · **Seen on:** Next.js, React

`revalidatePath`/`revalidateTag` was called while rendering a page or component, not from an action or route handler.

## Meaning

Revalidation is a mutation and may only run in Server Actions, Route Handlers or webhooks. Move the call to the action that changes data. For time-based refresh use `export const revalidate = 60` or `fetch(..., { next: { revalidate: 60 } })`.

## Common causes

- Calling `revalidatePath` inside a Server Component render
- Inside `unstable_cache` or cached functions
- During `generateMetadata`/layout
- In a data-fetching helper used by pages
- Called from a loop at render time

## Quick fix

1. Call it from a Server Action or Route Handler after the mutation
2. Use `revalidate` settings for time-based caching
3. Don't call from helpers used during render

## Detailed fix by platform

### Next.js

1. `"use server"; export async function savePost(d: FormData) { await db.save(d); revalidatePath("/blog"); }`

## How to diagnose

1. **Context** — Render or action?
2. **Cached** — Inside cached fn?
3. **Alternative** — Time-based revalidate?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/nextjs/revalidatepath-during-render)
