Firestore: Document exceeds the maximum size of 1,048,576 bytes Google Cloud / Firebase Origin: Platform & cloud OSI layer 7 · Application Last updated 4 Nov 2026

Firestore: 3 INVALID_ARGUMENT: The value of property "data" is longer than 1048487 bytes / Document exceeds the maximum size

A single Firestore document (all fields combined) went beyond the 1 MiB limit.

Exact message you may see Document exceeds the maximum size of 1,048,576 bytesINVALID_ARGUMENT: The value of property is longer than 1048487 bytesDocument cannot be written because its size exceeds the maximum allowed size3 INVALID_ARGUMENT: Document exceeds the maximum size
Seen on: Google Cloud JavaScript

Meaning

Firestore documents are small by design. Move large fields (images, JSON blobs, long arrays) to Cloud Storage and store references, split arrays into subcollections, and avoid ever-growing array fields. The limit also counts field names and nested data.

Common causes

  • Large base64 images or files stored in a field
  • Unbounded arrays/maps growing over time
  • Storing entire chat history in one document
  • Embedded large JSON
  • Index entries too many

⚡ Quick fix

  1. Store files in Cloud Storage and save URLs
  2. Use subcollections instead of big arrays
  3. Keep documents well below 1 MiB

Detailed fix by platform

Firebase

  1. Check document size in the console (Data view) or estimate with Buffer.byteLength(JSON.stringify(doc))

How to diagnose

  1. Size — Document bytes?
  2. Field — Largest field?
  3. Design — Subcollection possible?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: Platform & cloud. Errors that are often confused with or caused by this one (click to open):

Error 403: API has not been used in project (Terraform) — Terraform: Error: Error creating Network: googleapi: Error 403: Compute Engine API has not been used in project 123 before or it is disabled (Terraform)Error 403: API has no…Firebase CLI: Authentication Error: Your credentials are no longer valid — Firebase CLI: Error: Authentication Error: Your credentials are no longer valid. Please run firebase login --reauth (Google Cloud / Firebase)Firebase CLI: Authent…Firebase Hosting: Page Not Found on refresh (SPA routes) — Firebase Hosting: Page Not Found — This file does not exist and there was no 404.html or index.html found in the document root (Google Cloud / Firebase)Firebase Hosting: Pag…Firebase: Your project must be on the Blaze (pay-as-you-go) plan — Firebase CLI: Error: Your project my-app must be on the Blaze (pay-as-you-go) plan to complete this command. Required API cloudbuild.googleapis.com can't be enabled until the upgrade is complete (Google Cloud / Firebase)Firebase: Your projec…Firestore: DEADLINE_EXCEEDED / UNAVAILABLE — Firestore: 4 DEADLINE_EXCEEDED: Deadline exceeded / 14 UNAVAILABLE: The service is currently unavailable (Google Cloud / Firebase)Firestore: DEADLINE_E…Firestore: The query requires an index — Firestore: 9 FAILED_PRECONDITION: The query requires an index. You can create it here: https://console.firebase.google.com/... (Google Cloud / Firebase)Firestore: The query …Google provider: could not find default credentials — Terraform: Error: Attempted to load application default credentials since neither `credentials` nor `access_token` was set in the provider block. No credentials loaded (Terraform)Google provider: coul…messaging/registration-token-not-registered — Firebase Cloud Messaging: messaging/registration-token-not-registered — The provided registration token is not registered (Google Cloud / Firebase)messaging/registratio…Firestore…

Explore the map of this error Full error map →

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.