feat(dev): log the failing procedure in a tRPC batch - #5750
Merged
Conversation
Contributor
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (2 files)
Previous Review Summaries (2 snapshots, latest commit f54446c)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit f54446c)Status: No Issues Found | Recommendation: Merge Files Reviewed (1 files)
Previous review (commit 9677c81)Status: No Issues Found | Recommendation: Merge Files Reviewed (1 files)
Reviewed by grok-4.6 · Input: 56.2K · Output: 7.7K · Cached: 176.1K Review guidance: REVIEW.md from base branch |
A batched tRPC call answers 207 when one of its procedures fails, and the failure is folded into the response body. The fetch handler defined no onError hook, so nothing reached the server log. An operator saw `207 in 78ms` and had no way to tell which of a dozen batched procedures raised. That cost a mobile E2E section most of a night: it could confirm the data, the membership, and every handler precondition, and still could not name the failing call. Development only. Production reporting is unchanged.
iscekic
force-pushed
the
dev/trpc-batch-onerror
branch
from
August 31, 2026 10:45
9677c81 to
f54446c
Compare
iscekic
enabled auto-merge (squash)
August 31, 2026 14:50
pandemicsyn
approved these changes
Aug 31, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The problem
A batched tRPC call answers
207when one of its procedures fails, and folds thatfailure into the response body.
apps/web/src/app/api/trpc/[trpc]/route.tspassedfetchRequestHandleronlyendpointandcreateContext, with noonErrorhook,so nothing reached the server log.
An operator saw this and nothing else:
Four procedures, one of them failing, and no way to tell which or why.
What it cost
mobile-ui-repairs-63e7spent most of a night on one screen showingCould not load Security Agent. It ruled out, with evidence:organizationMemberProcedure, and the logrecords
Access granted, calling nextfour times before the batch;configuration, repository, or remediation row.
Three classes eliminated, and the cause is still unknown, because the error itself is
never printed. The screen remains unproved.
The change
Ten lines.
onErrorlogs the procedure type, its path, and the error code and message.Development only:
process.env.NODE_ENV === 'development', matching the convention inlib/constants.tsandlib/account-linking-session.ts. Production reporting isunchanged and gains no log line.
For other orchestrators
Any section that hits an opaque
207can cherry-pickdev/trpc-batch-onerrorinto itsworktree to see the failing procedure, without waiting for this to merge.
Checks
pnpm --filter @kilocode/web run typecheck— exit 0, no errors.oxfmtapplied; the file is clean.HTTPErrorHandlerOptions, so the signaturecannot drift from
@trpc/server.