Detecting a Stalled Indexer

By John Sullivan · December 6, 2026 · 17 min read · #indexer-lag #indexer-monitoring #block-lag #json-rpc #eth-getlogs

Your indexer was fine yesterday. The process is up, the health check is green, the loop logs a success line on every pass, and a user found the missing rows before you did. Nothing in that picture is broken in a way your existing checks can see.

Two measurements decide whether it happens again. Lag is the distance between your cursor and a reference head. Head age is how long it has been since the head you are following last changed. They answer different questions, and only one of them separates a chain that has gone quiet from an indexer that has stopped consuming it. Indexer lag monitoring watches the first. The second is the one that tells you which failure you have.

Noticing a stall while it is still a measurement rather than an incident is the whole job here. Recovery is a separate problem with its own arithmetic.

A running indexer is not a working indexer

What your process check actually proves

A process check answers one question: is the thing alive. It reads the PID, the container state, the last log line, the timestamp on the heartbeat file. All of those can be healthy while the indexer makes no progress at all.

The failure shape is dull, and that is why it survives review. The loop wakes, fetches a range, writes nothing because the range was already written, sets the cursor to the value it already held, and logs success. Every individual step succeeded. The cursor is unchanged. A check that asserts "the process is running" passes, and a check that asserts "the last run returned without error" passes too.

Progress is a different property from liveness, and it needs a different measurement: not the value of the cursor, but its change over an interval.

Lag and head age are two different measurements

Lag is a distance. You take the height your cursor has reached, subtract it from a reference height, and the difference is how far behind you are. Head age is a duration. You take the timestamp on the head block you are following, subtract it from now, and the difference is how stale your view of the chain is.

Both are needed because a single number cannot separate two very different situations. If the chain stops producing blocks, your cursor stops advancing and your lag grows. If your consumer stops consuming, your cursor stops advancing and your lag grows. Same reading, opposite causes, opposite responses: the first needs nothing from you, the second needs you now.

Head age breaks the tie. If the head you are following has not changed in a while, the chain is quiet and your indexer is probably fine. If the head keeps changing and your cursor does not, the chain is producing and you are not keeping up. Neither measurement is a threshold until you choose one; the comparison between them is what carries the information.

Getting a reference head you can trust

Which call gives you the chain's position

eth_blockNumber returns the number of the most recent block the node is following, as an unsigned integer, and it takes no parameters [1]. That is your reference height.

eth_getBlockByNumber takes a block number or a tag and returns either a block or a null [2]. The block object carries its own hash, number and timestamp as required fields [3], which is what makes head age measurable at all: you do not need a second call to date the head, because the head dates itself.

{"jsonrpc":"2.0","id":1,"method":"eth_blockNumber","params":[]}
{"jsonrpc":"2.0","id":1,"result":"0x1a2b3c"}

{"jsonrpc":"2.0","id":2,"method":"eth_getBlockByNumber","params":["safe",false]}
{"jsonrpc":"2.0","id":2,"result":{"number":"0x1a2b00","hash":"0x…","timestamp":"0x…"}}

The limit is real. eth_blockNumber reports the height that node is following, not the height of the chain [1]. On a shared endpoint that view belongs to the provider, and two requests moments apart can land on nodes at different heights [4]. You are measuring against someone else's observation of the chain, and the measurement is only as good as that observation.

Pin the comparison to a tag, not to the tip

Comparing your cursor to latest compares two moving things. latest is the most recent block in the canonical chain as the client observes it, and it can be re-orged out even under normal conditions [5]. Your cursor also moves. The difference between two moving values is noisy for reasons that have nothing to do with a stall, and a noisy measurement is one you will learn to ignore.

Two ways out. Compare against a tag that resolves to a fixed height, or record the height you compared at alongside the result so the measurement is reproducible. safe and finalized are the tags with specified meanings: safe is the newest block the spec treats as re-org-proof given an honest majority and synchrony, and finalized is the most recent block that cannot be re-orged outside manual intervention driven by community coordination [5].

Not every endpoint resolves both. The spec says an unresolvable safe or finalized tag is answered the way an unknown block is [5]. That is a difference to classify, not a fault to escalate: an endpoint that cannot answer finalized is telling you which reference it can give you, and you pick a different one.

What a null and an error each mean

Three outcomes get treated as one, and they are not the same fact.

Outcome What it is What it means for a stall check
A null block notFound, whose schema is the JSON null type [6] The node could not produce that block. Not a malformed request.
An empty array The eth_getLogs result for a range with no matching logs [7] Nothing matched in that range. Says nothing about whether the range was the right one.
A JSON-RPC error For example -32602 when a range bound resolves past the head [7] The request could not be answered as asked. Not the same fact as an empty result.

A null is a specified answer, not a malformed response. It is also not the only outcome for a block the node cannot produce: the same method declares a 4444 Pruned history unavailable error [8], so a null is the specified answer for a block the node cannot produce, not a guarantee that nothing else can come back.

An empty array is a specified answer too. eth_getLogs returns an array of all logs matching the filter [7], so a range with no matches returns an empty array. An empty array for a range you know contains matching logs is a finding; an empty array for a range that genuinely has none is not evidence of anything.

An error is the third thing, and it is the sharpest of the three. If either bound of an eth_getLogs range resolves past the current head, or fromBlock exceeds toBlock, clients must return -32602: Invalid params and must not clamp the range or return a partial result [7]. A range that runs past the head does not come back empty; it comes back as an error. A JSON-RPC response carries either a result or an error and never both [9], so the three outcomes are mutually exclusive at the transport level and only get conflated in your own handling.

The message text matters as well, because one string can mean two things. header not found is what you see when the block is genuinely absent, and also, per SwiftNodes' own error reference, when a request for the latest block is routed to a node that is slightly behind the others on a load-balanced endpoint [4]. That second case is a routing artefact, not a stall, and the same page's advice is to ask with a tag the node resolves itself rather than a number you read from a different request [4]. missing trie node is state requested at a block whose state the node no longer keeps [10]. A refusal from eth_getLogs is that node's span cap, a property of the node rather than of the chain [11]. -32601 on a debug_ or trace_ method usually means the node that answered was started without that namespace enabled, not that the method does not exist [12].

The checks that catch a stall

A check that cannot say what it misses is a check you will trust too far.

Check 1: cursor advance per interval

Record the cursor at time t and again at t+n. The measurement is the delta, not the value. A cursor sitting at a high number tells you nothing; a cursor that moved between two samples tells you the consumer is consuming.

const before = await readCursor();
await sleep(interval);
const after = await readCursor();
const delta = after - before;        // the measurement, not `after`
stalled = delta === 0 ? stalled + 1 : 0;

A cursor that has not moved across two consecutive intervals is the signal. Two, not one, because a single interval can legitimately contain no work: a range that was already written, a filter that matched nothing, a quiet chain. Two consecutive intervals with no movement is a different claim. A reorg can also make a height repeat, so a delta of zero is not automatically a stall [13].

The interval is yours to choose. Derive it from how much data you can afford to be missing and how quickly you can act, not from a block time. A block time is a property of the chain; your tolerance is a property of your system, and only the second one belongs in a monitoring interval.

What it misses: a cursor that advances while the writes do not land. That is Check 4.

Check 2: head age against your own last write

Head age is how long it has been since the head you are following last changed, and you measure it from the block's own timestamp rather than from your cursor [3]. Sample the head you are following, keep its hash and timestamp, and compare the new head's hash on the next pass. Same hash, and the head has not changed; different hash, and it has.

This is the check that separates a quiet chain from a stalled consumer, and it is the one most teams do not have. It catches a consumer that has stopped while the chain kept producing. It also catches the case where your cursor is advancing but your view of the head is frozen, which is what a stale endpoint looks like from inside your process.

What it misses: a chain that has genuinely stopped producing blocks. Head age grows in that case too, and it grows for a reason that is not yours. That is why head age is read next to lag and not instead of it.

Check 3: the gap between your cursor and the tag you trust

This is the lag measurement done properly: your cursor against a pinned reference rather than against the tip. Pin the reference to a tag that resolves to a fixed height, or record the height you compared at, so that two samples are comparable [5].

The number is only comparable to itself over time. A gap that is holding steady is a different fact from a gap that is widening. Holding steady means you are moving at the same speed as the chain, which is fine if you are caught up and useless if you are not. Widening means the chain is producing faster than you are consuming, and that is the one that matters.

What it misses: it cannot tell you whether the reference moved. A widening gap looks the same whether your consumer slowed down or the chain sped up, and only head age separates those.

Check 4: the write that did not land

A cursor that advances while the table does not grow. Count the rows you expect for a range against the rows you have, or compare the highest block number present in the table against the cursor. If the cursor is ahead of the data, the write did not land and the loop reported success anyway.

Idempotent writes make a re-run safe, and they also make a silent no-op look exactly like progress: the second write of the same row succeeds and changes nothing. That is the trade-off, and you need to know which side of it you are on — see making the write safe to repeat.

What it misses: a write that landed in the wrong place. Row counts match and the data is wrong.

Check 5: the subscription that is open and silent

A subscription can be acknowledged and then deliver nothing, with no error at all. SwiftNodes' error reference names that shape: the subscription is accepted, and then nothing arrives [14]. A successful eth_subscribe response is a handle, not evidence of delivery — it returns a subscription ID that eth_unsubscribe later takes [15].

Two properties make the silence expensive. Notifications cover current events only, not past ones, so a hole left by a silent subscription is not replayed when the subscription recovers [13]. And a subscription is bound to the connection that created it: geth's documentation, read 6 December 2026, puts it as "Subscriptions are coupled to a connection. If the connection is closed all subscriptions that are created over this connection are removed." [13]

For a subscription-driven indexer, head age is the only signal that catches this. Your cursor is not advancing because nothing is arriving, and nothing is arriving because the subscription is dead — and the connection may still be open, so a connection check passes. Filling the gap afterwards is a separate problem with its own method — see filling the gap after a WebSocket drop.

Alerting on absence, not on a number

Why a threshold you did not choose will page you wrongly

A threshold is three things: a named measurement, a window, and an owner who can act without asking. The number itself depends on your chain, the size of the ranges you scan, and how much staleness your users will tolerate. Nobody outside your system can supply it, and a number borrowed from someone else's system will page you for their conditions.

The part that matters is not the value but the fact that it was chosen in advance, by someone who is not currently being paged. A threshold invented at three in the morning while looking at a graph is a threshold fitted to the incident, and it will be wrong in both directions: too loose for the next one, too tight for the quiet week after.

So write down the measurement, the window and the owner, and leave the number to the person who owns the consequence.

The alert that never fires because nothing happened

The failure mode of a progress alert is silence. If the rule is "fire when the cursor stops", then a broken alert and a healthy indexer produce the same signal: nothing. You cannot tell them apart from the absence of a page, and the absence of a page is exactly what you are relying on.

The fix is a check that fires on the absence of the check itself. A heartbeat written by the monitoring job, with an alert on the heartbeat going stale, or a dead-man's switch that expects a periodic all-clear and pages when it does not arrive. Either way the alert is inverted: it fires when nothing happened, which is the case you cannot otherwise see.

This is the check people forget, and it is the one that catches the week nobody looked.

Separating your stall from the chain's

Three branches, and the measurements you already have put you in one of them.

The reference head moved and yours did not: it is yours. The chain is producing, your consumer is not consuming, and the response is on your side.

Neither moved: the chain is quiet and your indexer is fine. Head age is growing for a reason that is not a fault, and the correct action is to wait and to make sure your alert knows the difference.

Neither moved and you cannot tell which: the endpoint is the third possibility. A reference head that is frozen because the node you are asking is stale looks identical to a chain that has stopped. That is a freshness question rather than a liveness one — see freshness rather than liveness.

The first ten minutes

Establish the boundary before you fix anything

Find the last block you are confident about. That single number is the input to every recovery step, and it is far cheaper to establish now than to reconstruct afterwards from logs you did not keep.

Confident means a block whose data you can verify against the chain, not merely the last one your cursor claims. Fetch the block by number and check that the hash matches what you stored, and check that the state you need at that height is still available. State at a block the node no longer keeps fails as missing trie node [10], and a boundary you cannot verify against state is not a boundary you are confident in.

Write the number down before you touch anything else.

Do not restart into a re-run you have not bounded

Restarting is the reflex and it is the wrong first move when the write is not idempotent, because the re-run can duplicate rather than repair. Check that first — see making the write safe to repeat — and if it is not, the restart waits until you have a range you can bound.

A restart also destroys the state you were about to inspect: the in-memory cursor, the open subscription, the last error text. If you have not captured the boundary and the last error, you are restarting into the same failure with less information than you had.

Resume against a range, not against the tip

The recovery is a backfill with a bounded range, and the range is the boundary you just established: from the last-good block forward to a height you can name. Resuming against the tip means you never know which blocks you skipped.

Name the end height before you start, so that "done" is a comparison rather than a feeling. How to size that range is its own problem — see budgeting the backfill range.

Knowing the stall is over

The exit condition

Three conditions, not one. The cursor is advancing across consecutive intervals. Head age is back to its normal shape for your chain. The gap to the pinned reference is closing rather than holding.

One is not enough, and the reason is arithmetic. A cursor can advance while the gap holds, which means you are moving at the same speed as the chain and will never catch up. Head age can look normal while your cursor is stuck, because the chain is producing and you are not consuming. And the gap can close because the reference stopped moving rather than because you moved.

All three together is the only combination that says you are consuming at the chain's rate and closing the distance.

What to write down

Four things: the last-good block, the first-bad block, the measurement that caught it, and whether the alert actually fired.

The last two are the ones people skip and the ones that pay. The measurement that caught it tells you which check earned its place, and the check that did not catch it is a check to fix or delete. Whether the alert fired tells you whether your alerting works at all — if a user told you before the page did, that is the finding, and it tells you more than the postmortem prose around it.

That record is what turns the next stall into a five-minute event instead of an incident.

Where this leaves you

Four decisions, and all of them are cheap to make now and expensive to make during the next incident.

Measure the delta and not the value: a cursor's change over an interval is progress, and its current number is not. Measure head age as well as lag, because lag alone cannot separate a quiet chain from a stalled consumer and head age can. Alert on absence as well as on a number, because an alert that fires when the cursor stops is silent in exactly the case where it is broken. And establish the boundary before you touch anything, because the first ten minutes are the only ones where the evidence is still there.

None of these checks catches every stall. They catch the ones that leave a measurable trace, and knowing which trace you are missing is the difference between a measurement and a hope.

Check live status

Sources

  1. execution-apis/src/eth/client.yaml — eth_blockNumber summary — ethereum/execution-apis (GitHub)
  2. execution-apis/src/eth/block.yaml — eth_getBlockByNumber result is notFound or Block — ethereum/execution-apis (GitHub)
  3. execution-apis/src/schemas/block.yaml — Block object requires hash, number and timestamp — ethereum/execution-apis (GitHub)
  4. SwiftNodes /errors — header-not-found, the too-new case on a load-balanced endpoint — SwiftNodes, 2026-09-24
  5. execution-apis/src/schemas/block.yaml — BlockTag, latest is the head observed by the client and may be re-orged — ethereum/execution-apis (GitHub), 2021-06-16
  6. execution-apis/src/schemas/base-types.yaml — the notFound schema is the JSON null type — ethereum/execution-apis (GitHub)
  7. execution-apis/src/eth/filter.yaml — eth_getLogs returns an array of matching logs — ethereum/execution-apis (GitHub)
  8. execution-apis/src/eth/block.yaml — eth_getBlockByNumber declares error 4444 Pruned history unavailable — ethereum/execution-apis (GitHub)
  9. JSON-RPC 2.0 Specification — Response Object, result and error are mutually exclusive — jsonrpc.org (JSON-RPC Working Group), 2021-06-16
  10. SwiftNodes /errors — missing-trie-node, what it means — SwiftNodes, 2026-09-23
  11. SwiftNodes /errors — eth-getlogs-block-range-too-large, the cap is a property of the node — SwiftNodes, 2026-09-24
  12. SwiftNodes /errors — method-does-not-exist-or-is-not-available, what -32601 means here — SwiftNodes, 2026-09-24
  13. Real-time Events — newHeads: a reorg emits the last header in the new chain, so a height can repeat — Go-Ethereum (geth documentation), 2023-08-16
  14. SwiftNodes /errors — eth-subscribe-not-available, acknowledged subscription with no notifications — SwiftNodes, 2026-09-24
  15. execution-apis/src/eth/subscribe.yaml — eth_subscribe returns a subscription ID — ethereum/execution-apis (GitHub), 2021-06-16

This article was researched, written and edited by AI under human supervision, and checked against Rankwrite's public editorial rubric.

J
John Sullivan
Infrastructure Writer, SwiftNodes

John Sullivan covers RPC infrastructure, node operations, and multi-chain development at SwiftNodes — what it actually takes to keep endpoints fast, fresh, and reliable across EVM and non-EVM networks.

Related posts

Try SwiftNodes free — multi-chain RPC across 140 networks, flat-rate pricing, pay by card or crypto, no KYC. Get an API key in 30 seconds →