Repository navigation
Conversation
Batch refusals and failed subrequests answered bare strings with ad-hoc statuses, so an ORPCError thrown while the batch body is read, such as the Request Limit Plugin's, lost its code, status and data. - routing interceptors receive `encodeError`, and `StandardHandler` exposes it - `StandardHandlerCodec.encodeError` takes `procedure`, `path` and `options` as optional - batch refusals are BAD_REQUEST / PAYLOAD_TOO_LARGE errors, a thrown ORPCError is kept as is - unmatched subrequests and standard-peer requests share `createNoProcedureMatchedError`
No codec read `procedure`, `path` or `options`, and an error raised outside a procedure has none.
More templates
@orpc/ai-sdk
@orpc/arktype
@orpc/bun
@orpc/client
@orpc/cloudflare
@orpc/contract
@orpc/effect
@orpc/evlog
@orpc/hibernation
@orpc/json-schema
@orpc/experimental-lock
@orpc/mcp
@orpc/msw
@orpc/nest
@orpc/next
@orpc/node
@orpc/openapi
@orpc/experimental-openapi-inference
@orpc/opentelemetry
@orpc/pinia-colada
@orpc/pino
@orpc/publisher
@orpc/ratelimit
@orpc/server
@orpc/shared
@orpc/swr
@orpc/tanstack-query
@orpc/trpc
@orpc/valibot
@orpc/zod
commit: |
|
No actionable comments were generated in the recent review. Summary
Merge Risk:
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Merging this PR will improve performance by 15.57%2 warnings
Performance Changes
Tip Curious why performance improved? Comment Comparing Footnotes
|
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| 🔵 In progress View logs |
orpc | 0a616d9 | Nov 23 2026, 08:12 AM |
There was a problem hiding this comment.
ℹ️ Minor suggestion only — one narrow behavior change to check.
Approach: sound — routing batch refusals through the handler's own codec means RPC and OpenAPI clients decode a real ORPCError instead of failing on a plain-string body, and it reuses the existing error encoding rather than adding a second format.
Reviewed changes — all 14 changed files, focused on the codec narrowing, the batch refusal paths, and the peer no-match path.
encodeErroron the handler and routing interceptors —StandardHandlerexposesencodeError(error)and passes it into routing interceptor options;StandardHandlerCodec.encodeErrornarrows to just the error.- Batch refusals are encoded errors — malformed, missing-
data, and wrong-method batches becomeBAD_REQUEST, over-limit batchesPAYLOAD_TOO_LARGE, and a body plugin'sORPCErrorkeeps its code, status, message and data. - Subresponses and peers — unmatched subrequests and unmatched peer requests return
createNoProcedureMatchedError()encoded through the codec; throws inmapSubrequest/mapSubresponsebecome encoded 500s. - Docs and tests — tips on the RPC/OpenAPI handler pages, updated unit tests, and an end-to-end refusal test through
BatchLinkPlugin.
deepseek-v4.1-flash-1017 (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — the single commit since the prior pullfrog review (0a616d9), focused on the batch maxSize failure path it fixes.
maxSizefailures propagate again — the size check moved out ofreadMessages' refusaltryand back into the routing interceptor body, so a throwingmaxSizecallback rejectshandler.handlewith the original error instead of being encoded as aBAD_REQUESTrefusal;readMessagesnow takes only the request, and the check still runs exactly once per batch.- Regression test — a new case asserts
handler.handlerejects with the exact error thrown bymaxSize, covering the failure mode the prior review called out.
Verified packages/server/src/plugins/batch.test.ts (71 tests) passes locally.
deepseek-v4.1-flash-1017 (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — the delta since the prior pullfrog review (5e2c46f0), in packages/server/src/plugins/batch.ts and batch.test.ts.
maxSizefailures propagate again — the size check moved out of the refusaltryand back into the interceptor body, so a throwing or rejectingmaxSizeValuesurfaces fromhandleinstead of being encoded as400 BAD_REQUEST, matching pre-PR behavior; a regression test asserts the original error is rethrown.readMessagesnarrowed to the request — the helper now takesStandardLazyRequestand no longer evaluatesmaxSize, leaving only body/parse failures in the refusal path.
Verified with pnpm vitest run packages/server/src/plugins/batch.test.ts (71 passed).
deepseek-v4.1-flash-1017 (free via Pullfrog for OSS) | 𝕏

Why
BatchHandlerPluginanswered batch-level failures with bare strings and ad-hoc statuses. A batch overRequestLimitHandlerPlugin's limit got400plus the error message as text, instead of413with thePAYLOAD_TOO_LARGEJSON, and that plugin's customerroroption was dropped. On the client, every call in the batch then failed with a generic error rather than the realORPCError.What changed
encodeError(error), andStandardHandlerhas a publicencodeError(error). Both go through the handler's codec, so RPC and OpenAPI handlers each use their own error format.BAD_REQUEST, a batch abovemaxSizeisPAYLOAD_TOO_LARGE, and anORPCErrorthrown while the body is read keeps its code, status, message and data. Anything else thrown there becomesBAD_REQUEST.NOT_FOUND, and a throw inmapSubrequest/mapSubresponseisINTERNAL_SERVER_ERROR(still surfaced as an unhandled rejection).createNoProcedureMatchedError()in@orpc/server/standardis shared by the batch plugin and the standard-peer adapter.StandardHandlerCodec.encodeErrortakes only the error. No built-in codec readprocedure,pathoroptions, and an error raised outside a procedure has none.BatchLinkPluginneeded no change: it already forwards a ≥400 batch response to each call's codec. An end-to-end test covers it.encodeError.Before / after for an over-limit batch:
Breaking
400.StandardHandlerRoutingInterceptorOptionshas a requiredencodeError. Code that builds these options by hand, or callsnext({...})without spreading, must pass it.StandardHandlerCodec.encodeErrorno longer receivesprocedure,pathoroptions.NOT_FOUNDinstead of a string body.Notes for review
next().erroroption likeRequestLimitHandlerPluginhas; left out as beyond this fix.pnpm checkandpnpm docs:validatepass. The server, openapi, mcp andtests/batchtests pass, except oneopenapi-inferencetest ("names the nearest tsconfig…") in a package this PR does not touch; not checked againstmain.