At 03:14 UTC, a liquidation bot on a mid-cap lending market stopped liquidating. It did not crash. It did not log an error. Its position indexer returned an empty array, its aggregation function computed the sum of collateral across zero rows, and that sum came back as 0. Zero is a valid number. Zero passes schema validation. Zero is the correct answer to the wrong question. The bot kept running — process alive, endpoint returning 200, latency nominal — while a position that had drifted to a health factor of 0.94 sat untouched for nineteen minutes.
I have reconstructed that sequence three times in three different codebases over the past four years. The variables change. The shape does not. Somewhere between the RPC response and the risk model, an absence gets coerced into a quantity, and the entire downstream stack proceeds with confidence on a number that was never measured. This is not an edge case. It is a structural property of how the industry builds data infrastructure, and it is the specific class of defect that bull markets are best at hiding.
The bytecode lies; the transaction log does not. But the log has to be read, and the reading layer is where the lies get reintroduced.
The pipeline has five places to lose a fact
An on-chain analytics stack looks simple from the outside: node, indexer, schema, aggregation, surface. Five boundaries. A fact can disappear at any of them, and at four of the five it can disappear silently.
Start at the node. A JSON-RPC call to eth_getLogs over a wide block range will be rejected or truncated by most hosted providers, each with its own undocumented cap. An archive query against a pruned node returns an error — usually. Some provider configurations return an empty result set instead. That distinction matters enormously and almost nobody checks for it. You get back [], and [] is indistinguishable from "this address emitted no logs in this range." One is a measurement of zero activity. The other is a measurement of nothing.
Then the indexer. Graph-based subgraphs expose _meta { hasIndexingErrors, block { number, hash } }. That metadata is the single most under-consumed API in DeFi. A subgraph that has fallen behind — three blocks on mainnet is routine, twelve during a reorg is not — will happily answer queries from a stale head. During a reorg, a naive indexer either appends blocks it has already written without deduplication, or drops the orphaned range without backfilling. Either way, the query returns a set. It is just not the right set. Reproducibility is the only currency of truth, and without pinning block.number to every snapshot, your numbers are not reproducible.
Then the schema. Here is the line that has done more damage to DeFi risk reporting than any exploit I have audited: "positions": {"type": "array"}. In JSON Schema, that permits an empty array. It permits it by default, because the default for minItems is zero. Pydantic does the same. TypeScript's Position[] does the same. An empty list is a perfectly well-typed list. Validation passes. The green checkmark renders.
Then aggregation, which is where the coercion happens. In Python, sum([]) returns 0. In JavaScript, [].reduce((a, b) => a + b.balance, 0) returns 0. In Solidity, an uninitialized mapping slot returns the type default, which for uint256 is 0 and for address is 0x0000…. But in SQL, SUM() over zero rows returns NULL, not 0. That divergence is not academic. COALESCE(SUM(x), 0) is the most destructive single line in on-chain analytics, because it collapses "the query returned no rows" and "the query returned rows that sum to zero" into one value. The first is a pipeline failure. The second is a market state. They are not the same, and once you merge them you can never separate them again.
Then the surface. A dashboard renders 0 in a column. A leaderboard sorts it. A model consumes it. Nobody looks at a zero and asks whether it was observed or constructed.
The EVM makes this worse by design, and better by design
Solidity's default-value semantics are elegant and hostile to exactly this class of reasoning. balances[someAddress] returns 0 for an address that never held the token, and also returns 0 for an address that held ten million units and spent every one. The chain does not distinguish a non-participant from a fully-exited participant. Both are zero. That is correct EVM behavior and it is also a permanent invitation to misread state.
In 2017 I audited contracts for ICO treasuries in Sydney, line by line, mostly hunting integer overflow. What I kept finding instead was accounting that depended on an absence meaning something. One project computed circulating supply off-chain as totalSupply minus the sum of known burn addresses. When the burn list came back empty — which it did, every time the treasury script ran before the first burn event — the reduce call threw. The developer had wrapped it in a bare exception handler that returned 0. Circulating supply published as zero. Market capitalization published as zero. A valuation model upstream divided a revenue figure by that market cap and produced Infinity, which sorted to the top of an internal ranking table and flagged the token as the most undervalued asset in the portfolio for six days.

I want to be precise about the causal chain, because the lazy reading is wrong. The bug was not in the exception handler. The bug was in the assumption that an empty burn list is an event to be handled rather than an event to be reported. The handler did what handlers do: it kept the process alive. Pressure tests expose what calm markets hide — and so does silence in the logs.

Note the asymmetry that runs through all of this. On-chain, integer division by zero reverts the transaction. Solidity will not let you render nonsense; the EVM stops the execution path and refunds the gas. Off-chain, division by zero in floating point returns NaN, and NaN propagates through arithmetic without raising anything. Worse: every comparison against NaN evaluates to false. So a liquidation condition written as if (healthFactor < 1.0) { liquidate(); } never fires when healthFactor is NaN. There is no exception. There is no log entry. The condition simply is not met, forever, for every position, and the bot reports zero liquidations — which on a quiet night looks exactly like a quiet night.
The chain reverts. The dashboard renders. That single sentence explains a disproportionate share of the losses I have traced.
Oracle silence is not a price
Chainlink's latestRoundData() returns five values: roundId, answer, startedAt, updatedAt, answeredInRound. The consumer-facing documentation has told integrators for years to check all of them — updatedAt != 0, answeredInRound >= roundId, answer > 0, and an age bound against block.timestamp. A large fraction of production consumers check the answer and nothing else.
This is survivable on high-volume pairs. ETH/USD on mainnet carries a heartbeat and a deviation threshold; it updates constantly. It is not survivable on thin pairs. A feed with a 24-hour heartbeat and a 1% deviation threshold will, on a quiet weekend, go hours without a new round. Those hours are not a gap in the data. They are the data. The last printed price is the protocol's best available estimate, and the protocol says so explicitly via updatedAt. A consumer that ignores updatedAt is asserting that a price from eleven hours ago is current. In a bull market that assertion is usually harmless, because the deviation threshold has already triggered on the way up. It becomes expensive on the way down, when a 4% drawdown arrives inside a heartbeat window and the feed is still printing a price that nobody can trade at.
Layer 2 integrations added a second layer to this. Sequencer uptime feeds exist precisely because a sequencer outage produces stale prices on an otherwise healthy Rollup. Skip the uptime feed and you get a price that is fresh by updatedAt and worthless by reality. Decentralized sequencing has been a PowerPoint for two years; the sequencer is one node, it goes down, and when it does, every feed on that chain is lying politely.
During the DeFi summer of 2020 I modeled liquidation depth for Compound and Aave across roughly fifty thousand on-chain transactions, building out the collateral distribution transaction by transaction. The finding that mattered was not the leverage. It was that a meaningful share of positions classified as healthy were healthy only because an index had never been initialized — the position's debt was denominated in a market whose borrow index had not been touched since supply, and the naive read of borrowBalanceStored returned the principal, not the accrued balance. The number was real. It was just measured at the wrong time. Under-collateralized loans, invisible, and structurally invisible: no amount of better dashboarding would have surfaced them, because the dashboard was reading a correctly-typed zero-accrual state.
Empty sets do not just hide risk. They manufacture false rankings.
This is the part that gets missed. Aiding and abetting the concealment is an active distortion. Take a yield leaderboard that sorts pools by fees_24h / tvl. When a subgraph fails and TVL returns as 0, the ratio becomes Infinity in floating point or throws in integer math — and if it throws, someone wraps it. Either way the pool climbs the leaderboard. The failure does not demote the asset; it promotes it. The dashboard's most visible output now points capital directly at the asset with the worst data integrity. I have watched this happen with a lending market's incentive APR. Broken feed, denominator zero, APR rendered as four digits, forty-one million in deposits inside a week.
NFT floor prices are the purest form of the pathology. Floor is conventionally the minimum of the live ask set. When the ask set is empty, the minimum is undefined. Stored in a column with DEFAULT 0, it becomes a floor of zero. In 2021 I tracked whale wallet clusters across roughly ten thousand CryptoPunks and Bored Ape transactions and identified wash-trading patterns inflating floors by about 15% — self-matched trades between wallets funded from a common source, timestamped within the same block, priced at the top of the book. The counterfactual failure is the mirror image: filter out the wash trades aggressively enough and the ask set empties, the floor collapses to zero, and a collateral engine reading that column liquidates a borrower against a price that no seller ever quoted. The blue-chip label is not a property of the asset. It is a property of a sufficiently thick bid set, and bid sets thin faster than anyone models.
The same reasoning applies one layer up, at the custody boundary. Proof of reserves as commonly implemented is a Merkle sum tree over liabilities plus a set of address attestations over assets. A leaf with zero balance is still a valid leaf with a valid inclusion proof. An attestation is a point-in-time snapshot, and the gap between attestation cadence and settlement cadence is where the interesting events live. In 2025, working through compliance filings and transaction logs alongside spot ETF custody arrangements, the pattern I kept flagging to clients was not a discrepancy in the numbers. It was a discrepancy in the reporting interval — a snapshot taken at a boundary chosen by the reporting entity, with no requirement that the boundary be adversarially chosen. A zero in an unaudited gap is not evidence of zero.
The contrarian read: the bug is not the problem
Everything above invites the obvious conclusion — fix the null checks, add minItems: 1, stop using COALESCE. That conclusion is correct and it will not help you, because the empty payload is almost always benign. Sparsity is a real market state. A wallet genuinely holds nothing. A pool genuinely has no positions. A collection genuinely has no asks. If you alert on every empty set, you will generate hundreds of pages a week and your on-call rotation will mute the channel inside nine days. The signal dies of noise, which is the ordinary fate of every naive monitor in this industry.
So the mitigation is not prevention. It is blast radius. Correlation is not causation: the dashboard showing TVL at zero did not cause the liquidation. The liquidation engine's missing null-check caused it. Two systems, one shared assumption, no shared ownership. The engineering question is not "how do we stop empty payloads" — you cannot — but "how far does a single empty payload propagate before something refuses to consume it." A pipeline with a provenance tag on every value and a hard refusal at the risk boundary survives the same bug that destroys a pipeline with a green checkmark.
The uncomfortable structural point is that nobody is paid to notice silence. In a decentralized data stack, the indexer, the oracle, the aggregator, and the consuming protocol are four different teams with four different incentives, and the failure lives in the seams where no one's SLA applies. A monitoring system that measures liveness will report that everything is fine. Liveness is not correctness. A process responding 200 with an empty body is alive and wrong.
What to watch next week
Three numbers, all cheap to obtain, none of them commonly instrumented. First, _meta.block.number lag per subgraph, alerted at a threshold you have actually measured rather than guessed. Second, latestRoundData().updatedAt age relative to heartbeat, per feed, per chain — and specifically on the thin pairs, where the age is largest. Third, and least glamorous: whether your empty state renders differently from your zero. Take a screenshot of your dashboard with the indexer stopped and compare it to a screenshot with the market genuinely at rest. If those two images are identical, you do not have a monitoring system. You have a guess with a logo, and the next quiet night will tell you which one you built.
Data does not dream; it only records. The question worth carrying into next week is not whether your pipeline can return a number. It is whether you would be able to tell, from the outside, if it stopped measuring and started guessing.