Cannot read properties of undefined (reading 'data') of, when trpc errors out

Hello everyone, I am using @trpc/react-query alongside trpc for express, and I am experiencing a crash when I have an error

 debug:   Server listening on port: 3000 at development mode
 error:   ERROR OCCURED: '[\n' +
   '  {\n' +
   '    "code": "invalid_type",\n' +
   '    "expected": "object",\n' +
   '    "received": "undefined",\n' +
   '    "path": [],\n' +
   '    "message": "Required"\n' +
   '  }\n' +
 error:   ERROR OCCURED: "Cannot read properties of undefined (reading 'data')"
             const data =;

 TypeError: Cannot read properties of undefined (reading 'data')
     at /work/company/monorepo/node_modules/@trpc/server/dist/config-200d5226.js:63:36
     at (<anonymous>)
     at Object.getHTTPStatusCode (/work/company/monorepo/node_modules/@trpc/server/dist/config-200d5226.js:61:38)
     at endResponse (/work/company/monorepo/node_modules/@trpc/server/dist/resolveHTTPResponse-e94bc3b5.js:46:29)
     at Object.resolveHTTPResponse (/work/company/monorepo/node_modules/@trpc/server/dist/resolveHTTPResponse-e94bc3b5.js:194:16)
     at processTicksAndRejections (node:internal/process/task_queues:96:5)
     at async Object.nodeHTTPRequestHandler (/work/company/monorepo/node_modules/@trpc/server/dist/nodeHTTPRequestHandler-b0d356ac.js:52:20)
     at async /work/company/monorepo/node_modules/@trpc/server/dist/adapters/express.js:16:9
 [nodemon] app crashed - waiting for file changes before starting...
I am running the latest version 10.10.0

This is the part from trpc that is erroring out

function getHTTPStatusCode(json) {
    const arr = Array.isArray(json) ? json : [
    const httpStatuses = new Set(>{
        if ('error' in res) {
            const data =;
            if (typeof data.httpStatus === 'number') {
                return data.httpStatus;
            const code = TRPC_ERROR_CODES_BY_NUMBER[res.error.code];
            return getStatusCodeFromKey(code);
        return 200;
    if (httpStatuses.size !== 1) {
        return 207;
    const httpStatus = httpStatuses.values().next().value;
    return httpStatus;

Here is my express trpc setup

export const trpc = initTRPC.context<Context>().create({
    transformer: superjson,
    errorFormatter: ({ error, type, path, input, ctx }) => {
        const logger: Logger = Container.get("logger");
        //TODO sentry or similar product for errors
        logger.error("ERROR OCCURED: %o", error.message);
        logger.error("ERROR DATA: %o", (error as any).data);

            router: appRouter,
            createContext: sessionContext,

const accountCreate = trpc.procedure
      email: z.string().min(1).email(),
  .mutation(async ({ input }) => {

export const userRouter = trpc.router({

Also not even sure about the zod error at the moment (not sure what is undefined, but thats for later debugging)
A/Kalex / KATT2/6/2023
Could you create an issue? If it crashes there it looks like something we should fix or provide a better error for