# Next.js: Failed to set Next.js data cache for https://api.example.com/data, items over 2MB can not be cached (2437412 bytes)

**Code:** `Failed to set Next.js data cache, items over 2MB can not be cached` · **Category:** Next.js · **Seen on:** Next.js

A `fetch` response was too large for Next.js's data cache (limit 2 MB), so it wasn't cached.

## Meaning

Only the caching fails; the request still works. To fix: fetch less data (pagination, field selection), cache your own processed result in a smaller form, use `cache: 'no-store'` for large responses, or store large payloads in a database/blob and cache the reference.

## Common causes

- Large API/CMS responses
- Fetching whole collections
- Unpaginated lists
- Data containing images/base64
- Duplicate large fetches

## Quick fix

1. Request only needed fields/pagination
2. Use `cache: "no-store"` for large responses
3. Cache a reduced version via your own cache (Redis, KV)

## Detailed fix by platform

### Next.js

1. `await fetch(url, { cache: "no-store" })` to avoid the cache attempt

## How to diagnose

1. **Size** — Response bytes?
2. **Need** — All fields?
3. **Alternative** — Own cache?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/nextjs/data-cache-item-over-2mb)
