# Firestore: 4 DEADLINE_EXCEEDED: Deadline exceeded / 14 UNAVAILABLE: The service is currently unavailable

**Code:** `Firestore: DEADLINE_EXCEEDED / UNAVAILABLE` · **Category:** Google Cloud / Firebase · **Seen on:** Google Cloud, JavaScript

A Firestore request timed out or could not reach the service — contention, hot documents, large operations or network issues.

## Meaning

Retry with exponential backoff (client SDKs do for some calls). Reduce write contention (one document updated more than ~1/second sustained), batch large writes in chunks of 500, avoid unbounded queries, and check connectivity (offline persistence on mobile). ABORTED indicates transaction contention.

## Common causes

- Hot document updated too often (1 write/sec guideline)
- Large batch/transaction or large queries
- Network blocked/unstable
- Cloud Functions timeouts hitting Firestore
- Service transient issue

## Quick fix

1. Retry with backoff and jitter
2. Shard counters; spread writes across documents
3. Paginate queries and chunk batches

## Detailed fix by platform

### Firebase

1. Use `limit()` and cursors; for counters use distributed counters or `FieldValue.increment` across shards

## How to diagnose

1. **Code** — DEADLINE_EXCEEDED, UNAVAILABLE, ABORTED?
2. **Hotspot** — Single doc?
3. **Size** — Batch/query large?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/gcp/firestore-deadline-exceeded-unavailable)
