Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

fix(api): RPC handler collapses all errors to 500

Open Beginner friendly
#1,108 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
72/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
typescript
Domain
backend

Research direction

The catch block in handleOrpcRequest in apps/api/src/rpc/handlers.ts (around lines 84-100) returns INTERNAL_SERVER_ERROR for every error, so start there and check how handleAppError() is already used elsewhere in that file. Route known ORPCError instances through handleAppError() while keeping the 500 fallback for unexpected errors. Done when a regression test covers the 401 and 404 paths and the existing RPC tests still pass.

Written by the indexing model from the issue text.

Description

Bug: ORPCError statuses are incorrectly returned as HTTP 500

Description

In apps/api/src/rpc/handlers.ts:84–100, handleOrpcRequest catches all errors thrown by createContext() or handle() and returns INTERNAL_SERVER_ERROR (HTTP 500), regardless of the original error.

Although the error is logged via recordORPCError(), it is never passed to handleAppError(). As a result, known ORPCError instances lose their original HTTP status and error code.

Impact
  • Authentication failures (401) and permission errors (403) are reported as server errors.
  • Not-found (404), rate-limit (429), and payment-required (402) responses are incorrectly converted to 500.
  • Clients may retry non-retryable requests unnecessarily.
  • Error monitoring and alerting become less reliable because client errors are misclassified as server failures.
Expected Behavior

Known ORPCError instances should be passed through handleAppError() so their original error codes and HTTP statuses are preserved. Only genuinely unexpected errors should fall back to HTTP 500.

Acceptance Criteria
  • Preserve original status codes and error codes for known ORPCError instances.
  • Add regression tests covering at least the 401 and 404 paths.
  • Ensure unexpected errors still return HTTP 500.
  • Keep existing RPC tests passing.
Dominant language
TypeScript
Stars
1.2k
Forks
227
Avg merge
23h 41m
Merged PRs (30d)
250

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from databuddy-analytics/Databuddy

All issues in databuddy-analytics/Databuddy

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.