# When a VRF callback reverts

When your VRF callback reverts or runs out of gas, the request is still fulfilled and paid for on every provider below, and none of them calls your contract again on its own. What differs is where the random value ends up. On Chainlink VRF v2.5 and native Ronin VRF it is only in an event log, which a contract cannot read. Pyth Entropy and D20DAO let anyone deliver it again, and Randoo stores it on chain for your contract to read.

| Provider | Request after a failed callback | Where the random value is | Can it be delivered again? |
| --- | --- | --- | --- |
| Chainlink VRF v2.5, subscription | Commitment deleted, subscription charged | `outputSeed` in `RandomWordsFulfilled` (`success` false) | No |
| Chainlink VRF v2.5, wrapper (direct funding) | Callback record deleted, fee kept | `outputSeed` in the coordinator's `RandomWordsFulfilled`; the wrapper emits `WrapperFulfillmentFailed` | No |
| Native Ronin VRF | Marked finalized, fee and gas paid | `randomSeed` in `RandomSeedFulfilled` (`callbackResult` false) | No |
| Pyth Entropy | Kept, status `CALLBACK_FAILED` | `randomNumber` in `CallbackFailed` | Yes: anyone calls `revealWithCallback` again |
| D20DAO | Served and paid; the callback's own state changes are rolled back | Stored by the coordinator | Yes: anyone calls `retryCallback(requestId, gasLimit)` |
| Randoo | Fulfilled, fee kept, unused prepayment refunded | Stored: `seedOf(reqHash)` and `requests(requestId)` | Only D20DAO-interface requests, via `retryCallback` |

Each row comes from the provider's contract source, linked in its section below. Read on 2026-11-22.

## Chainlink VRF v2.5

The coordinator deletes the request's commitment, then calls `rawFulfillRandomWords` with exactly `callbackGasLimit` gas. Whether that call succeeds or not, it charges the subscription and emits `RandomWordsFulfilled(requestId, outputSeed, subId, payment, nativePayment, success, onlyPremium)`. A second fulfillment of the same request reverts with `NoCorrespondingRequest`, because the commitment is gone ([`VRFCoordinatorV2_5.sol`](https://cdn.jsdelivr.net/npm/@chainlink/contracts@1.5.0/src/v0.8/vrf/dev/VRFCoordinatorV2_5.sol), `@chainlink/contracts` 1.5.0, the latest release on 2026-11-22). Chainlink's [security page](https://docs.chain.link/vrf/v2-5/security) says the same: if `fulfillRandomWords()` reverts, the service will not call it a second time.

Through the direct-funding wrapper, the wrapper is the coordinator's consumer. It deletes its record of your request, calls your contract with your callback gas, and emits `WrapperFulfillmentFailed(requestId, consumer)` if that call fails ([`VRFV2PlusWrapper.sol`](https://cdn.jsdelivr.net/npm/@chainlink/contracts@1.5.0/src/v0.8/vrf/dev/VRFV2PlusWrapper.sol)). The wrapper's own call succeeded, so the coordinator's `RandomWordsFulfilled` for that request says `success` true. Watch the wrapper's event, not the coordinator's.

Off chain, you can still recompute the words: word `i` is `uint256(keccak256(abi.encode(outputSeed, i)))`. On chain nothing holds them, so the only way forward for the contract is a new request, which is a re-roll of an outcome that may already be public.

## Native Ronin VRF

Sky Mavis's coordinator marks the request finalized, sends the service fee to the treasury, and calls `rawFulfillRandomSeed(reqHash, seed)` with exactly `callbackGasLimit` gas. It then pays the oracle's gas, refunds the rest of your prepayment and emits `RandomSeedFulfilled(requestHash, randomSeed, requestValue, refundAmount, paymentAmount, constantFee, callbackResult)`. Storage keeps the finalized flag, the oracle and the block, not the seed, and a second fulfillment reverts. This is the `RoninVRFCoordinator` source verified by [Sourcify](https://sourcify.dev/) as an exact match for the implementation behind `0x16A62a921e7fEC5Bf867fF5c805b662Db757B778` on Ronin mainnet.

As with Chainlink, the seed survives only in the event. A consumer that needs it on chain has to make a new request.

## Pyth Entropy

For a request with a gas limit, `revealWithCallback` calls your callback in a way that catches a revert. If it reverts, Entropy emits `CallbackFailed` with the random number and sets the request's status to `CALLBACK_FAILED` instead of deleting it. Anyone can then call `revealWithCallback` again with the same contributions. That second call runs your callback with whatever gas the caller's transaction has, and without catching the revert, so the reason shows up and the transaction fails until the callback succeeds ([`Entropy.sol`](https://github.com/pyth-network/pyth-crosschain/blob/f06628c4212579ae2f2d7f0585caee61ee8df758/target_chains/ethereum/contracts/contracts/entropy/Entropy.sol), pyth-crosschain at f06628c, 2026-09-18; Pyth's [debugging guide](https://docs.pyth.network/entropy/debug-callback-failures)).

A request has a gas limit when its provider sets a default one. On Base, Pyth's default provider sets 500,000 (`getProviderInfoV2`, block 60,704,676), so every request through it gets this recovery path. If the reveal transaction itself is too short of gas to give the callback its limit, the whole reveal reverts with `InsufficientGas` and nothing is recorded.

## D20DAO

D20DAO's coordinator stores the accepted random word. If `rawFulfillRandomness` reverts or runs out of gas, the callback's own state changes are rolled back, the request stays served and paid, and anyone can deliver the same word again with `retryCallback(requestId, gasLimit)`. `gasLimit` must be at least the request's `callbackGasLimit` and at most 1,000,000, and each attempt emits `CallbackAttempted(requestId, success, gasLimit)` ([`@d20dao/vrf-sdk` 0.6.2](https://www.npmjs.com/package/@d20dao/vrf-sdk) README, "Keep the callback small" and "Gas for refund and retry calls"). D20DAO's README suggests a transaction gas limit of `gasLimit + 250,000` for the retry.

## Randoo

The coordinator calls your callback once, with exactly `callbackGasLimit` gas. If it reverts or runs out of gas, the fulfillment still succeeds: the coordinator keeps the service fee, refunds the unused prepayment and stores the seed. Then:

- For a Ronin-interface request, `seedOf(reqHash)` returns `(seed, fulfilled, callbackOk)`.
- For any request, `requests(requestId)` holds the same fields. A Chainlink-wrapper consumer expands the seed into words the same way, `keccak256(abi.encode(seed, i))`.
- A D20DAO-interface request can be delivered again with `retryCallback(requestId, gasLimit)`, as on D20DAO. The other two interfaces have no retry.
- If the oracle's own transaction is too short of gas to forward `callbackGasLimit`, the fulfillment reverts with `NotEnoughGas` and the request stays open. The oracle retries with more gas, and the seed does not change.

[Fees and failures](/docs/gas#callbacks) has the fee and refund side, and [Find a failed callback](#find-a-failed-callback) below has the `cast` call that reads the seed.

## A callback that cannot strand the game

The value is public the moment the fulfillment lands, in the event on every provider and in storage on Randoo. So recovery must finish the outcome from that same value, and nobody may get a choice between finishing and starting over. A new request after a failure is a re-roll, and a cancel or refund that still works after the fulfillment lets a player walk away from a loss.

Callbacks fail for a handful of reasons:

- **The callback gas limit is too low** for the worst path: first-time storage writes, a long loop, a larger collection than you tested with. Measure the worst case and add headroom; [How to set a VRF callback gas limit](/docs/callback-gas) has a Foundry test that does the measuring. Our guides measured up to 30,077 gas for a 10,000-token [NFT reveal](/docs/nft-reveal) and up to 106,761 for a 16-million-entry [raffle](/docs/raffle).
- **The callback sends value.** A winner that is a contract rejecting ETH, or burning gas in `receive`, reverts the whole callback. Pay with a 2,300-gas stipend and credit on failure, as in [Dice game with VRF](/docs/dice), or let winners pull.
- **The callback checks state that changed** between the request and the fulfillment: a paused contract, a closed round, an owner-only setting. Decide those at request time and store them with the request, keyed by its request ID, so the callback works however many requests are open ([Several VRF requests at once](/docs/concurrent-requests)).
- **The callback calls other contracts** whose behavior you do not control.

The pattern in every Randoo guide is to have the callback and a public `settle` run the same private function, which records that the request is done. This is from the tested [loot box](/docs/loot-box):

```solidity src/LootBox.sol (excerpt)
/// Finishes a box whose callback failed, from the seed the coordinator stored.
function settle(bytes32 reqHash) external {
    (uint256 seed, bool fulfilled,) = IRandooSeeds(vrfCoordinator).seedOf(reqHash);
    require(fulfilled, "pending");
    _open(reqHash, seed);
}

function _fulfillRandomSeed(bytes32 reqHash, uint256 seed) internal override {
    _open(reqHash, seed);
}

function _open(bytes32 reqHash, uint256 seed) private {
    address player = playerOf[reqHash];
    require(player != address(0) && !opened[reqHash], "opened");
    opened[reqHash] = true;
    // ... roll the items from `seed`
}
```

Anyone can call `settle`, so the player cannot hold back a bad box, and `opened` stops a second settlement. The [loot box](/docs/loot-box), [NFT reveal](/docs/nft-reveal), [raffle](/docs/raffle) and [dice](/docs/dice) guides each test this path with a callback starved of gas.

On Chainlink VRF v2.5 and native Ronin VRF there is no stored value to settle from, so the callback should only store the words and mark the request ready, and a separate function does the rest. D20DAO's own examples follow the same rule ("store, do not compute").

## Find a failed callback

Look up the fulfillment event for your request and read its success flag. Public RPCs limit how many blocks one log query may span (Ronin's public endpoint allows 200), so set `--from-block` and `--to-block` close to the fulfillment.

```bash Native Ronin VRF: callbackResult false means the callback failed
cast logs --rpc-url <ronin-rpc> --from-block <from> --to-block <to> \
  --address 0x16A62a921e7fEC5Bf867fF5c805b662Db757B778 \
  'RandomSeedFulfilled(bytes32 indexed requestHash,uint256 randomSeed,uint256 requestValue,uint256 refundAmount,uint256 paymentAmount,uint256 constantFee,bool callbackResult)' \
  <reqHash>
```

```bash Randoo: callbackOk false means the callback failed
cast call 0xC66eB2e7EE91145875000Ad46B55600000000001 'seedOf(bytes32)(uint256,bool,bool)' <reqHash> --rpc-url <rpc>
```

On Randoo, [Verify a number](/verify) also re-derives the seed from the request hash in your browser.

_Updated 2026-11-24._
