x402 2.30.0: a throwing gate hook now stops the payment
Last week the story was a release that closed a month of fixes. This week the cadence changed: a second release landed seven days later. It carries a fix we covered as unreleased two days ago, and we checked it in the published bundle.
We searched merged PRs in x402-foundation/x402 from 30 October to 6 November 2026. The GitHub search API returns 53. About half are small cleanups (PhilBot402), docs from mintlify[bot], or release PRs, so the count says little. The release says more.
The release, with dates
The npm registry dates @x402/core 2.30.0 at 2026-11-04 20:04:41 UTC. Version 2.29.0 is dated 28 October. That is seven days, against 29 days between 2.28.0 and 2.29.0.
PyPI shows x402 2.27.0 uploaded at 20:03 UTC the same day. The Go module has a go/v2.30.0 tag. Python numbering is independent of npm, so 2.27.0 on PyPI is the counterpart of 2.30.0.
The fix, checked in the bundle
On 4 November we published an audit of gate hook throws. The finding: in the TypeScript resource server, a beforeVerify or beforeSettle hook that throws was treated as approval. PR #3702 (issue #3689) changed that, and a follow-up, #4133, renamed the payer-facing codes.
We did not rely on the PR text. We unpacked the @x402/core tarballs for 2.29.0 and 2.30.0 and read dist/cjs/server/index.js.
- 2.29.0. The catch block around each hook calls
warnResourceServerHookFailure(...)and nothing else. Execution continues to the facilitator call. - 2.30.0, verify. The same catch block returns
isValid: falsewith reasonbefore_verify_hook_errorand messagebefore verify hook failed. - 2.30.0, settle. The catch block throws a
SettleError(400)with reasonbefore_settle_hook_errorand messagebefore settle hook failed, with an empty transaction. An existingSettleErrorfrom a hook is rethrown unchanged.
Per the PR text, the thrown error's own message stays in the server warn log and is not sent to the payer. That matters: a hook that talks to Redis can throw a connection error with an internal address in it.
So "merged" is now "shipped" for the TypeScript server. One limit on this claim: we read the bundle, we did not run a payment through it this week. The run we did was against main on 4 November.
Merged after the release, not shipped
Everything below merged on 5 or 6 November, after both release uploads. It cannot be in 2.30.0 or Python 2.27.0.
- Phantom and Lighthouse guards on SVM exact (#3615, merged 6 November, +2,493 / -486, 36 files). Path 1 verification used to tolerate Lighthouse instructions only after the transfer, in a window of 3 to 7 instructions. Phantom puts guards before and after. The PR classifies instructions by program ID and discriminator instead of position. Protocol instructions (compute limit, compute price,
TransferChecked, optional memo) must keep their relative order. Lighthouse may appear anywhere, with no upper bound. Any other program is rejected. The PR says it is additive and applies to v2 only, across TypeScript, Python and Go. - Unknown outcome on cancellation (#4151, #4152, #4172). Three PRs from 6 November make the Go client, Go MCP and TypeScript/Python MCP report an unknown outcome when a cancel call to the facilitator fails, instead of implying the payment was cancelled. This is the same theme as the double-sign audit: after a failure, "not paid" and "unknown" are different states.
- Gate hooks in Go and Python (#4149, #4153). Titles: "fail closed when a gate hook returns an error" (Go) and "use fixed errors when a gate hook throws" (Python). We have not tested either, so we only note that the other SDKs are following the TypeScript change.
- Facilitator-managed voucher custody (#4061, merged 4 November 18:19 UTC, 13,541 additions). With
extra.voucherManager: "facilitator", the facilitator owns the voucher store and admission locks, and the server forwards every payment. It also makes a depositafterSettlestorage error abort the settle. It merged less than two hours before the npm release. We did not check whether it is inside the 2.30.0 bundle, so treat it as unconfirmed.
Smaller: #4141 scopes EVM batch channel operations by network, and #4110 enforces XRPL spend caps in issued-currency units. We list them without testing them.
What it means for LLM4Agents
Our gateway is a payment gate in front of model calls. A gate hook is where we would put a balance check, a rate limit or a ledger write. Under 2.29.0, a bug in that hook would have turned a payment gate into a no-op without any visible sign except a warn line.
2.30.0 makes the safe behavior the default. It also changes what a flaky hook means: an outage in the store behind the hook now becomes a 402-style failure for the buyer, not a free request. That is the right trade, but it moves availability risk into our hooks.
The Lighthouse change matters for the Solana side. Phantom is a common wallet. A facilitator that rejects guard instructions placed before the transfer rejects valid payments, which looks like a flaky rail to the buyer.
Staying on the frontier
- Move to 2.30.0 (npm) and 2.27.0 (PyPI) in a branch. The diff from 2.29.0 is small. Re-run the probes that matter: a hook that throws must yield no facilitator call.
- Give every hook a timeout and a health check. Fail-closed turns a slow hook into lost revenue. We want to know before a buyer does.
- Alert on payer-facing codes. Count
before_verify_hook_errorandbefore_settle_hook_error. A rise means our own hook is failing. - Wait for the Lighthouse release before changing our SVM allowlist, then replay a Phantom-shaped transaction against a facilitator we use.
- Treat unknown as a state in our client. When a cancel or settle call fails, record "unknown" and reconcile later. Do not retry with a new signature.
Caveat on method: we confirmed the 2.29.0 and 2.30.0 server code by reading the published bundles. Everything under "merged after the release" is based on PR titles and text, and we did not run it.
Pay per call, with the SDK pinned for you
LLM4Agents tracks x402 releases so your agent does not have to.
Register agent