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.
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 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
- Store files in Cloud Storage and save URLs
- Use subcollections instead of big arrays
- Keep documents well below 1 MiB
Detailed fix by platform
Firebase
- Check document size in the console (Data view) or estimate with
Buffer.byteLength(JSON.stringify(doc))
How to diagnose
- Size — Document bytes?
- Field — Largest field?
- 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:
Similar errors
- 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
- 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
- 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
Most viewed in Google Cloud / Firebase
- Container failed to start Cloud Run: The user-provided container failed to start and listen on the port defined provided by the PORT=8080 environment variable
- Could not load the default credentials Google Cloud: Error: Could not load the default credentials. Browse to https://cloud.google.com/docs/authentication/getting-started
- 409: The resource already exists Compute Engine: ERROR: (gcloud.compute.instances.create) Could not fetch resource: The resource 'projects/p/zones/z/instances/vm-1' already exists
Other ways to find it
Where this error sits
Origin: Platform & cloud. Errors that are often confused with or caused by this one (click to open):
🧠 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.
Report a correction or suggest an improvement
Last updated 4 Nov 2026