[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill-trpc-error-handling":3,"mdc-vt8tw2-key":39,"related-repo-trpc-error-handling":4044,"related-org-trpc-error-handling":4149},{"slug":4,"name":4,"fn":5,"description":6,"org":7,"tags":11,"stars":23,"repoUrl":24,"updatedAt":25,"license":26,"forks":27,"topics":28,"repo":34,"sourceUrl":37,"mdContent":38},"error-handling","implement typed error handling in tRPC","Throw typed errors with TRPCError and error codes (NOT_FOUND, UNAUTHORIZED, BAD_REQUEST, INTERNAL_SERVER_ERROR), configure errorFormatter for client-side Zod error display, handle errors globally with onError callback, map tRPC errors to HTTP status codes with getHTTPStatusCodeFromError().\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},"trpc","tRPC","https:\u002F\u002Fpexgzepcugksgbtrxkhf.supabase.co\u002Fstorage\u002Fv1\u002Fobject\u002Fpublic\u002Forg-logos\u002Ftrpc.png",[12,16,19,20],{"name":13,"slug":14,"type":15},"Backend","backend","tag",{"name":17,"slug":18,"type":15},"TypeScript","typescript",{"name":9,"slug":8,"type":15},{"name":21,"slug":22,"type":15},"Debugging","debugging",40424,"https:\u002F\u002Fgithub.com\u002Ftrpc\u002Ftrpc","2026-07-18T05:46:52.798151",null,1636,[29,30,31,32,33,18],"api","next","nextjs","prisma","react",{"repoUrl":24,"stars":23,"forks":27,"topics":35,"description":36},[29,30,31,32,33,18],"🧙‍♀️  Move Fast and Break Nothing. End-to-end typesafe APIs made easy. ","https:\u002F\u002Fgithub.com\u002Ftrpc\u002Ftrpc\u002Ftree\u002FHEAD\u002Fpackages\u002Fserver\u002Fskills\u002Ferror-handling","---\nname: error-handling\ndescription: >\n  Throw typed errors with TRPCError and error codes (NOT_FOUND, UNAUTHORIZED,\n  BAD_REQUEST, INTERNAL_SERVER_ERROR), configure errorFormatter for client-side\n  Zod error display, handle errors globally with onError callback, map tRPC errors\n  to HTTP status codes with getHTTPStatusCodeFromError().\ntype: core\nlibrary: trpc\nlibrary_version: '11.16.0'\nrequires:\n  - server-setup\nsources:\n  - 'trpc\u002Ftrpc:www\u002Fdocs\u002Fserver\u002Ferror-handling.md'\n  - 'trpc\u002Ftrpc:www\u002Fdocs\u002Fserver\u002Ferror-formatting.md'\n  - 'trpc\u002Ftrpc:packages\u002Fserver\u002Fsrc\u002Funstable-core-do-not-import\u002Ferror\u002FTRPCError.ts'\n---\n\n# tRPC -- Error Handling\n\n## Setup\n\n```ts\n\u002F\u002F server\u002Ftrpc.ts\nimport { initTRPC } from '@trpc\u002Fserver';\nimport { ZodError } from 'zod';\n\nconst t = initTRPC.create({\n  errorFormatter({ shape, error }) {\n    return {\n      ...shape,\n      data: {\n        ...shape.data,\n        zodError:\n          error.code === 'BAD_REQUEST' && error.cause instanceof ZodError\n            ? error.cause.flatten()\n            : null,\n      },\n    };\n  },\n});\n\nexport const router = t.router;\nexport const publicProcedure = t.procedure;\n```\n\n## Core Patterns\n\n### Throwing typed errors from procedures\n\n```ts\nimport { TRPCError } from '@trpc\u002Fserver';\nimport { z } from 'zod';\nimport { publicProcedure, router } from '.\u002Ftrpc';\n\nexport const appRouter = router({\n  userById: publicProcedure\n    .input(z.object({ id: z.string() }))\n    .query(({ input }) => {\n      const user = getUserFromDb(input.id);\n      if (!user) {\n        throw new TRPCError({\n          code: 'NOT_FOUND',\n          message: `User with id ${input.id} not found`,\n        });\n      }\n      return user;\n    }),\n});\n\nfunction getUserFromDb(id: string) {\n  if (id === '1') return { id: '1', name: 'Katt' };\n  return null;\n}\n```\n\n### Wrapping original errors with cause\n\n```ts\nimport { TRPCError } from '@trpc\u002Fserver';\nimport { publicProcedure, router } from '.\u002Ftrpc';\n\nexport const appRouter = router({\n  riskyOperation: publicProcedure.mutation(async () => {\n    try {\n      return await externalService();\n    } catch (err) {\n      throw new TRPCError({\n        code: 'INTERNAL_SERVER_ERROR',\n        message: 'An unexpected error occurred, please try again later.',\n        cause: err,\n      });\n    }\n  }),\n});\n\nasync function externalService() {\n  throw new Error('connection refused');\n}\n```\n\nPass the original error as `cause` to retain the stack trace for debugging.\n\n### Global error handling with onError\n\n```ts\nimport { createHTTPServer } from '@trpc\u002Fserver\u002Fadapters\u002Fstandalone';\nimport { appRouter } from '.\u002FappRouter';\n\nconst server = createHTTPServer({\n  router: appRouter,\n  onError(opts) {\n    const { error, type, path, input, ctx, req } = opts;\n    console.error('Error:', error);\n    if (error.code === 'INTERNAL_SERVER_ERROR') {\n      \u002F\u002F send to bug reporting service\n    }\n  },\n});\n\nserver.listen(3000);\n```\n\n### Extracting HTTP status from TRPCError\n\n```ts\nimport { TRPCError } from '@trpc\u002Fserver';\nimport { getHTTPStatusCodeFromError } from '@trpc\u002Fserver\u002Fhttp';\n\nfunction handleError(error: unknown) {\n  if (error instanceof TRPCError) {\n    const httpCode = getHTTPStatusCodeFromError(error);\n    console.log(httpCode); \u002F\u002F e.g., 400, 401, 404, 500\n  }\n}\n```\n\n## Common Mistakes\n\n### [HIGH] Throwing plain Error instead of TRPCError\n\nWrong:\n\n```ts\nimport { publicProcedure } from '.\u002Ftrpc';\n\nconst proc = publicProcedure.query(() => {\n  throw new Error('Not found');\n  \u002F\u002F client receives 500 INTERNAL_SERVER_ERROR\n});\n```\n\nCorrect:\n\n```ts\nimport { TRPCError } from '@trpc\u002Fserver';\nimport { publicProcedure } from '.\u002Ftrpc';\n\nconst proc = publicProcedure.query(() => {\n  throw new TRPCError({\n    code: 'NOT_FOUND',\n    message: 'User not found',\n  });\n  \u002F\u002F client receives 404 NOT_FOUND\n});\n```\n\nPlain Error objects are caught and wrapped as INTERNAL_SERVER_ERROR (500); use TRPCError with a specific code for proper HTTP status mapping.\n\nSource: www\u002Fdocs\u002Fserver\u002Ferror-handling.md\n\n### [MEDIUM] Expecting stack traces in production\n\nWrong:\n\n```ts\nimport { initTRPC } from '@trpc\u002Fserver';\n\n\u002F\u002F No explicit isDev setting\nconst t = initTRPC.create();\n\u002F\u002F Stack traces may or may not appear depending on NODE_ENV\n```\n\nCorrect:\n\n```ts\nimport { initTRPC } from '@trpc\u002Fserver';\n\nconst t = initTRPC.create({\n  isDev: process.env.NODE_ENV === 'development',\n});\n```\n\nStack traces are included only when `isDev` is true (default: `NODE_ENV !== \"production\"`); set `isDev` explicitly for deterministic behavior across runtimes.\n\nSource: www\u002Fdocs\u002Fserver\u002Ferror-handling.md\n\n### [HIGH] Not handling Zod errors in errorFormatter\n\nWrong:\n\n```ts\nimport { initTRPC } from '@trpc\u002Fserver';\n\n\u002F\u002F No errorFormatter -- client gets generic \"Input validation failed\"\nconst t = initTRPC.create();\n```\n\nCorrect:\n\n```ts\nimport { initTRPC } from '@trpc\u002Fserver';\nimport { ZodError } from 'zod';\n\nconst t = initTRPC.create({\n  errorFormatter({ shape, error }) {\n    return {\n      ...shape,\n      data: {\n        ...shape.data,\n        zodError:\n          error.code === 'BAD_REQUEST' && error.cause instanceof ZodError\n            ? error.cause.flatten()\n            : null,\n      },\n    };\n  },\n});\n```\n\nWithout a custom errorFormatter, the client receives a generic message without field-level validation details from Zod.\n\nSource: www\u002Fdocs\u002Fserver\u002Ferror-formatting.md\n\n## Error Code Reference\n\n| Code                  | HTTP | Use when                             |\n| --------------------- | ---- | ------------------------------------ |\n| BAD_REQUEST           | 400  | Invalid input                        |\n| UNAUTHORIZED          | 401  | Missing or invalid auth credentials  |\n| FORBIDDEN             | 403  | Authenticated but not authorized     |\n| NOT_FOUND             | 404  | Resource does not exist              |\n| CONFLICT              | 409  | Request conflicts with current state |\n| UNPROCESSABLE_CONTENT | 422  | Valid syntax but semantic error      |\n| TOO_MANY_REQUESTS     | 429  | Rate limit exceeded                  |\n| INTERNAL_SERVER_ERROR | 500  | Unexpected server error              |\n\n## See Also\n\n- `server-setup` -- initTRPC configuration including isDev\n- `validators` -- input validation that triggers BAD_REQUEST errors\n- `middlewares` -- auth middleware throwing UNAUTHORIZED\n- `server-side-calls` -- catching TRPCError in server-side callers\n",{"data":40,"body":49},{"name":4,"description":6,"type":41,"library":8,"library_version":42,"requires":43,"sources":45},"core","11.16.0",[44],"server-setup",[46,47,48],"trpc\u002Ftrpc:www\u002Fdocs\u002Fserver\u002Ferror-handling.md","trpc\u002Ftrpc:www\u002Fdocs\u002Fserver\u002Ferror-formatting.md","trpc\u002Ftrpc:packages\u002Fserver\u002Fsrc\u002Funstable-core-do-not-import\u002Ferror\u002FTRPCError.ts",{"type":50,"children":51},"root",[52,61,68,618,624,631,1360,1366,1849,1862,1868,2291,2297,2549,2555,2566,2571,2731,2736,2989,2994,2999,3010,3014,3118,3122,3282,3310,3314,3324,3328,3424,3428,3794,3799,3804,3810,3984,3990,4038],{"type":53,"tag":54,"props":55,"children":57},"element","h1",{"id":56},"trpc-error-handling",[58],{"type":59,"value":60},"text","tRPC -- Error Handling",{"type":53,"tag":62,"props":63,"children":65},"h2",{"id":64},"setup",[66],{"type":59,"value":67},"Setup",{"type":53,"tag":69,"props":70,"children":75},"pre",{"className":71,"code":72,"language":73,"meta":74,"style":74},"language-ts shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","\u002F\u002F server\u002Ftrpc.ts\nimport { initTRPC } from '@trpc\u002Fserver';\nimport { ZodError } from 'zod';\n\nconst t = initTRPC.create({\n  errorFormatter({ shape, error }) {\n    return {\n      ...shape,\n      data: {\n        ...shape.data,\n        zodError:\n          error.code === 'BAD_REQUEST' && error.cause instanceof ZodError\n            ? error.cause.flatten()\n            : null,\n      },\n    };\n  },\n});\n\nexport const router = t.router;\nexport const publicProcedure = t.procedure;\n","ts","",[76],{"type":53,"tag":77,"props":78,"children":79},"code",{"__ignoreMap":74},[80,92,145,187,197,242,283,296,315,333,359,373,437,472,486,495,504,513,531,539,580],{"type":53,"tag":81,"props":82,"children":85},"span",{"class":83,"line":84},"line",1,[86],{"type":53,"tag":81,"props":87,"children":89},{"style":88},"--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#546E7A;--shiki-default-font-style:italic;--shiki-dark:#676E95;--shiki-dark-font-style:italic",[90],{"type":59,"value":91},"\u002F\u002F server\u002Ftrpc.ts\n",{"type":53,"tag":81,"props":93,"children":95},{"class":83,"line":94},2,[96,102,108,114,119,124,129,135,140],{"type":53,"tag":81,"props":97,"children":99},{"style":98},"--shiki-light:#39ADB5;--shiki-light-font-style:italic;--shiki-default:#89DDFF;--shiki-default-font-style:italic;--shiki-dark:#89DDFF;--shiki-dark-font-style:italic",[100],{"type":59,"value":101},"import",{"type":53,"tag":81,"props":103,"children":105},{"style":104},"--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF",[106],{"type":59,"value":107}," {",{"type":53,"tag":81,"props":109,"children":111},{"style":110},"--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8",[112],{"type":59,"value":113}," initTRPC",{"type":53,"tag":81,"props":115,"children":116},{"style":104},[117],{"type":59,"value":118}," }",{"type":53,"tag":81,"props":120,"children":121},{"style":98},[122],{"type":59,"value":123}," from",{"type":53,"tag":81,"props":125,"children":126},{"style":104},[127],{"type":59,"value":128}," '",{"type":53,"tag":81,"props":130,"children":132},{"style":131},"--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D",[133],{"type":59,"value":134},"@trpc\u002Fserver",{"type":53,"tag":81,"props":136,"children":137},{"style":104},[138],{"type":59,"value":139},"'",{"type":53,"tag":81,"props":141,"children":142},{"style":104},[143],{"type":59,"value":144},";\n",{"type":53,"tag":81,"props":146,"children":148},{"class":83,"line":147},3,[149,153,157,162,166,170,174,179,183],{"type":53,"tag":81,"props":150,"children":151},{"style":98},[152],{"type":59,"value":101},{"type":53,"tag":81,"props":154,"children":155},{"style":104},[156],{"type":59,"value":107},{"type":53,"tag":81,"props":158,"children":159},{"style":110},[160],{"type":59,"value":161}," ZodError",{"type":53,"tag":81,"props":163,"children":164},{"style":104},[165],{"type":59,"value":118},{"type":53,"tag":81,"props":167,"children":168},{"style":98},[169],{"type":59,"value":123},{"type":53,"tag":81,"props":171,"children":172},{"style":104},[173],{"type":59,"value":128},{"type":53,"tag":81,"props":175,"children":176},{"style":131},[177],{"type":59,"value":178},"zod",{"type":53,"tag":81,"props":180,"children":181},{"style":104},[182],{"type":59,"value":139},{"type":53,"tag":81,"props":184,"children":185},{"style":104},[186],{"type":59,"value":144},{"type":53,"tag":81,"props":188,"children":190},{"class":83,"line":189},4,[191],{"type":53,"tag":81,"props":192,"children":194},{"emptyLinePlaceholder":193},true,[195],{"type":59,"value":196},"\n",{"type":53,"tag":81,"props":198,"children":200},{"class":83,"line":199},5,[201,207,212,217,221,226,232,237],{"type":53,"tag":81,"props":202,"children":204},{"style":203},"--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA",[205],{"type":59,"value":206},"const",{"type":53,"tag":81,"props":208,"children":209},{"style":110},[210],{"type":59,"value":211}," t ",{"type":53,"tag":81,"props":213,"children":214},{"style":104},[215],{"type":59,"value":216},"=",{"type":53,"tag":81,"props":218,"children":219},{"style":110},[220],{"type":59,"value":113},{"type":53,"tag":81,"props":222,"children":223},{"style":104},[224],{"type":59,"value":225},".",{"type":53,"tag":81,"props":227,"children":229},{"style":228},"--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF",[230],{"type":59,"value":231},"create",{"type":53,"tag":81,"props":233,"children":234},{"style":110},[235],{"type":59,"value":236},"(",{"type":53,"tag":81,"props":238,"children":239},{"style":104},[240],{"type":59,"value":241},"{\n",{"type":53,"tag":81,"props":243,"children":245},{"class":83,"line":244},6,[246,252,257,263,268,273,278],{"type":53,"tag":81,"props":247,"children":249},{"style":248},"--shiki-light:#E53935;--shiki-default:#F07178;--shiki-dark:#F07178",[250],{"type":59,"value":251},"  errorFormatter",{"type":53,"tag":81,"props":253,"children":254},{"style":104},[255],{"type":59,"value":256},"({",{"type":53,"tag":81,"props":258,"children":260},{"style":259},"--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#EEFFFF;--shiki-default-font-style:italic;--shiki-dark:#BABED8;--shiki-dark-font-style:italic",[261],{"type":59,"value":262}," shape",{"type":53,"tag":81,"props":264,"children":265},{"style":104},[266],{"type":59,"value":267},",",{"type":53,"tag":81,"props":269,"children":270},{"style":259},[271],{"type":59,"value":272}," error",{"type":53,"tag":81,"props":274,"children":275},{"style":104},[276],{"type":59,"value":277}," })",{"type":53,"tag":81,"props":279,"children":280},{"style":104},[281],{"type":59,"value":282}," {\n",{"type":53,"tag":81,"props":284,"children":286},{"class":83,"line":285},7,[287,292],{"type":53,"tag":81,"props":288,"children":289},{"style":98},[290],{"type":59,"value":291},"    return",{"type":53,"tag":81,"props":293,"children":294},{"style":104},[295],{"type":59,"value":282},{"type":53,"tag":81,"props":297,"children":299},{"class":83,"line":298},8,[300,305,310],{"type":53,"tag":81,"props":301,"children":302},{"style":104},[303],{"type":59,"value":304},"      ...",{"type":53,"tag":81,"props":306,"children":307},{"style":110},[308],{"type":59,"value":309},"shape",{"type":53,"tag":81,"props":311,"children":312},{"style":104},[313],{"type":59,"value":314},",\n",{"type":53,"tag":81,"props":316,"children":318},{"class":83,"line":317},9,[319,324,329],{"type":53,"tag":81,"props":320,"children":321},{"style":248},[322],{"type":59,"value":323},"      data",{"type":53,"tag":81,"props":325,"children":326},{"style":104},[327],{"type":59,"value":328},":",{"type":53,"tag":81,"props":330,"children":331},{"style":104},[332],{"type":59,"value":282},{"type":53,"tag":81,"props":334,"children":336},{"class":83,"line":335},10,[337,342,346,350,355],{"type":53,"tag":81,"props":338,"children":339},{"style":104},[340],{"type":59,"value":341},"        ...",{"type":53,"tag":81,"props":343,"children":344},{"style":110},[345],{"type":59,"value":309},{"type":53,"tag":81,"props":347,"children":348},{"style":104},[349],{"type":59,"value":225},{"type":53,"tag":81,"props":351,"children":352},{"style":110},[353],{"type":59,"value":354},"data",{"type":53,"tag":81,"props":356,"children":357},{"style":104},[358],{"type":59,"value":314},{"type":53,"tag":81,"props":360,"children":362},{"class":83,"line":361},11,[363,368],{"type":53,"tag":81,"props":364,"children":365},{"style":248},[366],{"type":59,"value":367},"        zodError",{"type":53,"tag":81,"props":369,"children":370},{"style":104},[371],{"type":59,"value":372},":\n",{"type":53,"tag":81,"props":374,"children":376},{"class":83,"line":375},12,[377,382,386,390,395,399,404,408,413,417,421,426,431],{"type":53,"tag":81,"props":378,"children":379},{"style":110},[380],{"type":59,"value":381},"          error",{"type":53,"tag":81,"props":383,"children":384},{"style":104},[385],{"type":59,"value":225},{"type":53,"tag":81,"props":387,"children":388},{"style":110},[389],{"type":59,"value":77},{"type":53,"tag":81,"props":391,"children":392},{"style":104},[393],{"type":59,"value":394}," ===",{"type":53,"tag":81,"props":396,"children":397},{"style":104},[398],{"type":59,"value":128},{"type":53,"tag":81,"props":400,"children":401},{"style":131},[402],{"type":59,"value":403},"BAD_REQUEST",{"type":53,"tag":81,"props":405,"children":406},{"style":104},[407],{"type":59,"value":139},{"type":53,"tag":81,"props":409,"children":410},{"style":104},[411],{"type":59,"value":412}," &&",{"type":53,"tag":81,"props":414,"children":415},{"style":110},[416],{"type":59,"value":272},{"type":53,"tag":81,"props":418,"children":419},{"style":104},[420],{"type":59,"value":225},{"type":53,"tag":81,"props":422,"children":423},{"style":110},[424],{"type":59,"value":425},"cause",{"type":53,"tag":81,"props":427,"children":428},{"style":104},[429],{"type":59,"value":430}," instanceof",{"type":53,"tag":81,"props":432,"children":434},{"style":433},"--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B",[435],{"type":59,"value":436}," ZodError\n",{"type":53,"tag":81,"props":438,"children":440},{"class":83,"line":439},13,[441,446,450,454,458,462,467],{"type":53,"tag":81,"props":442,"children":443},{"style":104},[444],{"type":59,"value":445},"            ?",{"type":53,"tag":81,"props":447,"children":448},{"style":110},[449],{"type":59,"value":272},{"type":53,"tag":81,"props":451,"children":452},{"style":104},[453],{"type":59,"value":225},{"type":53,"tag":81,"props":455,"children":456},{"style":110},[457],{"type":59,"value":425},{"type":53,"tag":81,"props":459,"children":460},{"style":104},[461],{"type":59,"value":225},{"type":53,"tag":81,"props":463,"children":464},{"style":228},[465],{"type":59,"value":466},"flatten",{"type":53,"tag":81,"props":468,"children":469},{"style":248},[470],{"type":59,"value":471},"()\n",{"type":53,"tag":81,"props":473,"children":475},{"class":83,"line":474},14,[476,481],{"type":53,"tag":81,"props":477,"children":478},{"style":104},[479],{"type":59,"value":480},"            :",{"type":53,"tag":81,"props":482,"children":483},{"style":104},[484],{"type":59,"value":485}," null,\n",{"type":53,"tag":81,"props":487,"children":489},{"class":83,"line":488},15,[490],{"type":53,"tag":81,"props":491,"children":492},{"style":104},[493],{"type":59,"value":494},"      },\n",{"type":53,"tag":81,"props":496,"children":498},{"class":83,"line":497},16,[499],{"type":53,"tag":81,"props":500,"children":501},{"style":104},[502],{"type":59,"value":503},"    };\n",{"type":53,"tag":81,"props":505,"children":507},{"class":83,"line":506},17,[508],{"type":53,"tag":81,"props":509,"children":510},{"style":104},[511],{"type":59,"value":512},"  },\n",{"type":53,"tag":81,"props":514,"children":516},{"class":83,"line":515},18,[517,522,527],{"type":53,"tag":81,"props":518,"children":519},{"style":104},[520],{"type":59,"value":521},"}",{"type":53,"tag":81,"props":523,"children":524},{"style":110},[525],{"type":59,"value":526},")",{"type":53,"tag":81,"props":528,"children":529},{"style":104},[530],{"type":59,"value":144},{"type":53,"tag":81,"props":532,"children":534},{"class":83,"line":533},19,[535],{"type":53,"tag":81,"props":536,"children":537},{"emptyLinePlaceholder":193},[538],{"type":59,"value":196},{"type":53,"tag":81,"props":540,"children":542},{"class":83,"line":541},20,[543,548,553,558,562,567,571,576],{"type":53,"tag":81,"props":544,"children":545},{"style":98},[546],{"type":59,"value":547},"export",{"type":53,"tag":81,"props":549,"children":550},{"style":203},[551],{"type":59,"value":552}," const",{"type":53,"tag":81,"props":554,"children":555},{"style":110},[556],{"type":59,"value":557}," router ",{"type":53,"tag":81,"props":559,"children":560},{"style":104},[561],{"type":59,"value":216},{"type":53,"tag":81,"props":563,"children":564},{"style":110},[565],{"type":59,"value":566}," t",{"type":53,"tag":81,"props":568,"children":569},{"style":104},[570],{"type":59,"value":225},{"type":53,"tag":81,"props":572,"children":573},{"style":110},[574],{"type":59,"value":575},"router",{"type":53,"tag":81,"props":577,"children":578},{"style":104},[579],{"type":59,"value":144},{"type":53,"tag":81,"props":581,"children":583},{"class":83,"line":582},21,[584,588,592,597,601,605,609,614],{"type":53,"tag":81,"props":585,"children":586},{"style":98},[587],{"type":59,"value":547},{"type":53,"tag":81,"props":589,"children":590},{"style":203},[591],{"type":59,"value":552},{"type":53,"tag":81,"props":593,"children":594},{"style":110},[595],{"type":59,"value":596}," publicProcedure ",{"type":53,"tag":81,"props":598,"children":599},{"style":104},[600],{"type":59,"value":216},{"type":53,"tag":81,"props":602,"children":603},{"style":110},[604],{"type":59,"value":566},{"type":53,"tag":81,"props":606,"children":607},{"style":104},[608],{"type":59,"value":225},{"type":53,"tag":81,"props":610,"children":611},{"style":110},[612],{"type":59,"value":613},"procedure",{"type":53,"tag":81,"props":615,"children":616},{"style":104},[617],{"type":59,"value":144},{"type":53,"tag":62,"props":619,"children":621},{"id":620},"core-patterns",[622],{"type":59,"value":623},"Core Patterns",{"type":53,"tag":625,"props":626,"children":628},"h3",{"id":627},"throwing-typed-errors-from-procedures",[629],{"type":59,"value":630},"Throwing typed errors from procedures",{"type":53,"tag":69,"props":632,"children":634},{"className":71,"code":633,"language":73,"meta":74,"style":74},"import { TRPCError } from '@trpc\u002Fserver';\nimport { z } from 'zod';\nimport { publicProcedure, router } from '.\u002Ftrpc';\n\nexport const appRouter = router({\n  userById: publicProcedure\n    .input(z.object({ id: z.string() }))\n    .query(({ input }) => {\n      const user = getUserFromDb(input.id);\n      if (!user) {\n        throw new TRPCError({\n          code: 'NOT_FOUND',\n          message: `User with id ${input.id} not found`,\n        });\n      }\n      return user;\n    }),\n});\n\nfunction getUserFromDb(id: string) {\n  if (id === '1') return { id: '1', name: 'Katt' };\n  return null;\n}\n",[635],{"type":53,"tag":77,"props":636,"children":637},{"__ignoreMap":74},[638,678,718,768,775,807,824,896,934,982,1014,1039,1068,1125,1141,1149,1165,1181,1196,1203,1240,1337,1351],{"type":53,"tag":81,"props":639,"children":640},{"class":83,"line":84},[641,645,649,654,658,662,666,670,674],{"type":53,"tag":81,"props":642,"children":643},{"style":98},[644],{"type":59,"value":101},{"type":53,"tag":81,"props":646,"children":647},{"style":104},[648],{"type":59,"value":107},{"type":53,"tag":81,"props":650,"children":651},{"style":110},[652],{"type":59,"value":653}," TRPCError",{"type":53,"tag":81,"props":655,"children":656},{"style":104},[657],{"type":59,"value":118},{"type":53,"tag":81,"props":659,"children":660},{"style":98},[661],{"type":59,"value":123},{"type":53,"tag":81,"props":663,"children":664},{"style":104},[665],{"type":59,"value":128},{"type":53,"tag":81,"props":667,"children":668},{"style":131},[669],{"type":59,"value":134},{"type":53,"tag":81,"props":671,"children":672},{"style":104},[673],{"type":59,"value":139},{"type":53,"tag":81,"props":675,"children":676},{"style":104},[677],{"type":59,"value":144},{"type":53,"tag":81,"props":679,"children":680},{"class":83,"line":94},[681,685,689,694,698,702,706,710,714],{"type":53,"tag":81,"props":682,"children":683},{"style":98},[684],{"type":59,"value":101},{"type":53,"tag":81,"props":686,"children":687},{"style":104},[688],{"type":59,"value":107},{"type":53,"tag":81,"props":690,"children":691},{"style":110},[692],{"type":59,"value":693}," z",{"type":53,"tag":81,"props":695,"children":696},{"style":104},[697],{"type":59,"value":118},{"type":53,"tag":81,"props":699,"children":700},{"style":98},[701],{"type":59,"value":123},{"type":53,"tag":81,"props":703,"children":704},{"style":104},[705],{"type":59,"value":128},{"type":53,"tag":81,"props":707,"children":708},{"style":131},[709],{"type":59,"value":178},{"type":53,"tag":81,"props":711,"children":712},{"style":104},[713],{"type":59,"value":139},{"type":53,"tag":81,"props":715,"children":716},{"style":104},[717],{"type":59,"value":144},{"type":53,"tag":81,"props":719,"children":720},{"class":83,"line":147},[721,725,729,734,738,743,747,751,755,760,764],{"type":53,"tag":81,"props":722,"children":723},{"style":98},[724],{"type":59,"value":101},{"type":53,"tag":81,"props":726,"children":727},{"style":104},[728],{"type":59,"value":107},{"type":53,"tag":81,"props":730,"children":731},{"style":110},[732],{"type":59,"value":733}," publicProcedure",{"type":53,"tag":81,"props":735,"children":736},{"style":104},[737],{"type":59,"value":267},{"type":53,"tag":81,"props":739,"children":740},{"style":110},[741],{"type":59,"value":742}," router",{"type":53,"tag":81,"props":744,"children":745},{"style":104},[746],{"type":59,"value":118},{"type":53,"tag":81,"props":748,"children":749},{"style":98},[750],{"type":59,"value":123},{"type":53,"tag":81,"props":752,"children":753},{"style":104},[754],{"type":59,"value":128},{"type":53,"tag":81,"props":756,"children":757},{"style":131},[758],{"type":59,"value":759},".\u002Ftrpc",{"type":53,"tag":81,"props":761,"children":762},{"style":104},[763],{"type":59,"value":139},{"type":53,"tag":81,"props":765,"children":766},{"style":104},[767],{"type":59,"value":144},{"type":53,"tag":81,"props":769,"children":770},{"class":83,"line":189},[771],{"type":53,"tag":81,"props":772,"children":773},{"emptyLinePlaceholder":193},[774],{"type":59,"value":196},{"type":53,"tag":81,"props":776,"children":777},{"class":83,"line":199},[778,782,786,791,795,799,803],{"type":53,"tag":81,"props":779,"children":780},{"style":98},[781],{"type":59,"value":547},{"type":53,"tag":81,"props":783,"children":784},{"style":203},[785],{"type":59,"value":552},{"type":53,"tag":81,"props":787,"children":788},{"style":110},[789],{"type":59,"value":790}," appRouter ",{"type":53,"tag":81,"props":792,"children":793},{"style":104},[794],{"type":59,"value":216},{"type":53,"tag":81,"props":796,"children":797},{"style":228},[798],{"type":59,"value":742},{"type":53,"tag":81,"props":800,"children":801},{"style":110},[802],{"type":59,"value":236},{"type":53,"tag":81,"props":804,"children":805},{"style":104},[806],{"type":59,"value":241},{"type":53,"tag":81,"props":808,"children":809},{"class":83,"line":244},[810,815,819],{"type":53,"tag":81,"props":811,"children":812},{"style":248},[813],{"type":59,"value":814},"  userById",{"type":53,"tag":81,"props":816,"children":817},{"style":104},[818],{"type":59,"value":328},{"type":53,"tag":81,"props":820,"children":821},{"style":110},[822],{"type":59,"value":823}," publicProcedure\n",{"type":53,"tag":81,"props":825,"children":826},{"class":83,"line":285},[827,832,837,842,846,851,855,860,865,869,873,877,882,887,891],{"type":53,"tag":81,"props":828,"children":829},{"style":104},[830],{"type":59,"value":831},"    .",{"type":53,"tag":81,"props":833,"children":834},{"style":228},[835],{"type":59,"value":836},"input",{"type":53,"tag":81,"props":838,"children":839},{"style":110},[840],{"type":59,"value":841},"(z",{"type":53,"tag":81,"props":843,"children":844},{"style":104},[845],{"type":59,"value":225},{"type":53,"tag":81,"props":847,"children":848},{"style":228},[849],{"type":59,"value":850},"object",{"type":53,"tag":81,"props":852,"children":853},{"style":110},[854],{"type":59,"value":236},{"type":53,"tag":81,"props":856,"children":857},{"style":104},[858],{"type":59,"value":859},"{",{"type":53,"tag":81,"props":861,"children":862},{"style":248},[863],{"type":59,"value":864}," id",{"type":53,"tag":81,"props":866,"children":867},{"style":104},[868],{"type":59,"value":328},{"type":53,"tag":81,"props":870,"children":871},{"style":110},[872],{"type":59,"value":693},{"type":53,"tag":81,"props":874,"children":875},{"style":104},[876],{"type":59,"value":225},{"type":53,"tag":81,"props":878,"children":879},{"style":228},[880],{"type":59,"value":881},"string",{"type":53,"tag":81,"props":883,"children":884},{"style":110},[885],{"type":59,"value":886},"() ",{"type":53,"tag":81,"props":888,"children":889},{"style":104},[890],{"type":59,"value":521},{"type":53,"tag":81,"props":892,"children":893},{"style":110},[894],{"type":59,"value":895},"))\n",{"type":53,"tag":81,"props":897,"children":898},{"class":83,"line":298},[899,903,908,912,916,921,925,930],{"type":53,"tag":81,"props":900,"children":901},{"style":104},[902],{"type":59,"value":831},{"type":53,"tag":81,"props":904,"children":905},{"style":228},[906],{"type":59,"value":907},"query",{"type":53,"tag":81,"props":909,"children":910},{"style":110},[911],{"type":59,"value":236},{"type":53,"tag":81,"props":913,"children":914},{"style":104},[915],{"type":59,"value":256},{"type":53,"tag":81,"props":917,"children":918},{"style":259},[919],{"type":59,"value":920}," input",{"type":53,"tag":81,"props":922,"children":923},{"style":104},[924],{"type":59,"value":277},{"type":53,"tag":81,"props":926,"children":927},{"style":203},[928],{"type":59,"value":929}," =>",{"type":53,"tag":81,"props":931,"children":932},{"style":104},[933],{"type":59,"value":282},{"type":53,"tag":81,"props":935,"children":936},{"class":83,"line":317},[937,942,947,952,957,961,965,969,974,978],{"type":53,"tag":81,"props":938,"children":939},{"style":203},[940],{"type":59,"value":941},"      const",{"type":53,"tag":81,"props":943,"children":944},{"style":110},[945],{"type":59,"value":946}," user",{"type":53,"tag":81,"props":948,"children":949},{"style":104},[950],{"type":59,"value":951}," =",{"type":53,"tag":81,"props":953,"children":954},{"style":228},[955],{"type":59,"value":956}," getUserFromDb",{"type":53,"tag":81,"props":958,"children":959},{"style":248},[960],{"type":59,"value":236},{"type":53,"tag":81,"props":962,"children":963},{"style":110},[964],{"type":59,"value":836},{"type":53,"tag":81,"props":966,"children":967},{"style":104},[968],{"type":59,"value":225},{"type":53,"tag":81,"props":970,"children":971},{"style":110},[972],{"type":59,"value":973},"id",{"type":53,"tag":81,"props":975,"children":976},{"style":248},[977],{"type":59,"value":526},{"type":53,"tag":81,"props":979,"children":980},{"style":104},[981],{"type":59,"value":144},{"type":53,"tag":81,"props":983,"children":984},{"class":83,"line":335},[985,990,995,1000,1005,1010],{"type":53,"tag":81,"props":986,"children":987},{"style":98},[988],{"type":59,"value":989},"      if",{"type":53,"tag":81,"props":991,"children":992},{"style":248},[993],{"type":59,"value":994}," (",{"type":53,"tag":81,"props":996,"children":997},{"style":104},[998],{"type":59,"value":999},"!",{"type":53,"tag":81,"props":1001,"children":1002},{"style":110},[1003],{"type":59,"value":1004},"user",{"type":53,"tag":81,"props":1006,"children":1007},{"style":248},[1008],{"type":59,"value":1009},") ",{"type":53,"tag":81,"props":1011,"children":1012},{"style":104},[1013],{"type":59,"value":241},{"type":53,"tag":81,"props":1015,"children":1016},{"class":83,"line":361},[1017,1022,1027,1031,1035],{"type":53,"tag":81,"props":1018,"children":1019},{"style":98},[1020],{"type":59,"value":1021},"        throw",{"type":53,"tag":81,"props":1023,"children":1024},{"style":104},[1025],{"type":59,"value":1026}," new",{"type":53,"tag":81,"props":1028,"children":1029},{"style":228},[1030],{"type":59,"value":653},{"type":53,"tag":81,"props":1032,"children":1033},{"style":248},[1034],{"type":59,"value":236},{"type":53,"tag":81,"props":1036,"children":1037},{"style":104},[1038],{"type":59,"value":241},{"type":53,"tag":81,"props":1040,"children":1041},{"class":83,"line":375},[1042,1047,1051,1055,1060,1064],{"type":53,"tag":81,"props":1043,"children":1044},{"style":248},[1045],{"type":59,"value":1046},"          code",{"type":53,"tag":81,"props":1048,"children":1049},{"style":104},[1050],{"type":59,"value":328},{"type":53,"tag":81,"props":1052,"children":1053},{"style":104},[1054],{"type":59,"value":128},{"type":53,"tag":81,"props":1056,"children":1057},{"style":131},[1058],{"type":59,"value":1059},"NOT_FOUND",{"type":53,"tag":81,"props":1061,"children":1062},{"style":104},[1063],{"type":59,"value":139},{"type":53,"tag":81,"props":1065,"children":1066},{"style":104},[1067],{"type":59,"value":314},{"type":53,"tag":81,"props":1069,"children":1070},{"class":83,"line":439},[1071,1076,1080,1085,1090,1095,1099,1103,1107,1111,1116,1121],{"type":53,"tag":81,"props":1072,"children":1073},{"style":248},[1074],{"type":59,"value":1075},"          message",{"type":53,"tag":81,"props":1077,"children":1078},{"style":104},[1079],{"type":59,"value":328},{"type":53,"tag":81,"props":1081,"children":1082},{"style":104},[1083],{"type":59,"value":1084}," `",{"type":53,"tag":81,"props":1086,"children":1087},{"style":131},[1088],{"type":59,"value":1089},"User with id ",{"type":53,"tag":81,"props":1091,"children":1092},{"style":104},[1093],{"type":59,"value":1094},"${",{"type":53,"tag":81,"props":1096,"children":1097},{"style":110},[1098],{"type":59,"value":836},{"type":53,"tag":81,"props":1100,"children":1101},{"style":104},[1102],{"type":59,"value":225},{"type":53,"tag":81,"props":1104,"children":1105},{"style":110},[1106],{"type":59,"value":973},{"type":53,"tag":81,"props":1108,"children":1109},{"style":104},[1110],{"type":59,"value":521},{"type":53,"tag":81,"props":1112,"children":1113},{"style":131},[1114],{"type":59,"value":1115}," not found",{"type":53,"tag":81,"props":1117,"children":1118},{"style":104},[1119],{"type":59,"value":1120},"`",{"type":53,"tag":81,"props":1122,"children":1123},{"style":104},[1124],{"type":59,"value":314},{"type":53,"tag":81,"props":1126,"children":1127},{"class":83,"line":474},[1128,1133,1137],{"type":53,"tag":81,"props":1129,"children":1130},{"style":104},[1131],{"type":59,"value":1132},"        }",{"type":53,"tag":81,"props":1134,"children":1135},{"style":248},[1136],{"type":59,"value":526},{"type":53,"tag":81,"props":1138,"children":1139},{"style":104},[1140],{"type":59,"value":144},{"type":53,"tag":81,"props":1142,"children":1143},{"class":83,"line":488},[1144],{"type":53,"tag":81,"props":1145,"children":1146},{"style":104},[1147],{"type":59,"value":1148},"      }\n",{"type":53,"tag":81,"props":1150,"children":1151},{"class":83,"line":497},[1152,1157,1161],{"type":53,"tag":81,"props":1153,"children":1154},{"style":98},[1155],{"type":59,"value":1156},"      return",{"type":53,"tag":81,"props":1158,"children":1159},{"style":110},[1160],{"type":59,"value":946},{"type":53,"tag":81,"props":1162,"children":1163},{"style":104},[1164],{"type":59,"value":144},{"type":53,"tag":81,"props":1166,"children":1167},{"class":83,"line":506},[1168,1173,1177],{"type":53,"tag":81,"props":1169,"children":1170},{"style":104},[1171],{"type":59,"value":1172},"    }",{"type":53,"tag":81,"props":1174,"children":1175},{"style":110},[1176],{"type":59,"value":526},{"type":53,"tag":81,"props":1178,"children":1179},{"style":104},[1180],{"type":59,"value":314},{"type":53,"tag":81,"props":1182,"children":1183},{"class":83,"line":515},[1184,1188,1192],{"type":53,"tag":81,"props":1185,"children":1186},{"style":104},[1187],{"type":59,"value":521},{"type":53,"tag":81,"props":1189,"children":1190},{"style":110},[1191],{"type":59,"value":526},{"type":53,"tag":81,"props":1193,"children":1194},{"style":104},[1195],{"type":59,"value":144},{"type":53,"tag":81,"props":1197,"children":1198},{"class":83,"line":533},[1199],{"type":53,"tag":81,"props":1200,"children":1201},{"emptyLinePlaceholder":193},[1202],{"type":59,"value":196},{"type":53,"tag":81,"props":1204,"children":1205},{"class":83,"line":541},[1206,1211,1215,1219,1223,1227,1232,1236],{"type":53,"tag":81,"props":1207,"children":1208},{"style":203},[1209],{"type":59,"value":1210},"function",{"type":53,"tag":81,"props":1212,"children":1213},{"style":228},[1214],{"type":59,"value":956},{"type":53,"tag":81,"props":1216,"children":1217},{"style":104},[1218],{"type":59,"value":236},{"type":53,"tag":81,"props":1220,"children":1221},{"style":259},[1222],{"type":59,"value":973},{"type":53,"tag":81,"props":1224,"children":1225},{"style":104},[1226],{"type":59,"value":328},{"type":53,"tag":81,"props":1228,"children":1229},{"style":433},[1230],{"type":59,"value":1231}," string",{"type":53,"tag":81,"props":1233,"children":1234},{"style":104},[1235],{"type":59,"value":526},{"type":53,"tag":81,"props":1237,"children":1238},{"style":104},[1239],{"type":59,"value":282},{"type":53,"tag":81,"props":1241,"children":1242},{"class":83,"line":582},[1243,1248,1252,1256,1260,1264,1269,1273,1277,1282,1286,1290,1294,1298,1302,1306,1310,1315,1319,1323,1328,1332],{"type":53,"tag":81,"props":1244,"children":1245},{"style":98},[1246],{"type":59,"value":1247},"  if",{"type":53,"tag":81,"props":1249,"children":1250},{"style":248},[1251],{"type":59,"value":994},{"type":53,"tag":81,"props":1253,"children":1254},{"style":110},[1255],{"type":59,"value":973},{"type":53,"tag":81,"props":1257,"children":1258},{"style":104},[1259],{"type":59,"value":394},{"type":53,"tag":81,"props":1261,"children":1262},{"style":104},[1263],{"type":59,"value":128},{"type":53,"tag":81,"props":1265,"children":1266},{"style":131},[1267],{"type":59,"value":1268},"1",{"type":53,"tag":81,"props":1270,"children":1271},{"style":104},[1272],{"type":59,"value":139},{"type":53,"tag":81,"props":1274,"children":1275},{"style":248},[1276],{"type":59,"value":1009},{"type":53,"tag":81,"props":1278,"children":1279},{"style":98},[1280],{"type":59,"value":1281},"return",{"type":53,"tag":81,"props":1283,"children":1284},{"style":104},[1285],{"type":59,"value":107},{"type":53,"tag":81,"props":1287,"children":1288},{"style":248},[1289],{"type":59,"value":864},{"type":53,"tag":81,"props":1291,"children":1292},{"style":104},[1293],{"type":59,"value":328},{"type":53,"tag":81,"props":1295,"children":1296},{"style":104},[1297],{"type":59,"value":128},{"type":53,"tag":81,"props":1299,"children":1300},{"style":131},[1301],{"type":59,"value":1268},{"type":53,"tag":81,"props":1303,"children":1304},{"style":104},[1305],{"type":59,"value":139},{"type":53,"tag":81,"props":1307,"children":1308},{"style":104},[1309],{"type":59,"value":267},{"type":53,"tag":81,"props":1311,"children":1312},{"style":248},[1313],{"type":59,"value":1314}," name",{"type":53,"tag":81,"props":1316,"children":1317},{"style":104},[1318],{"type":59,"value":328},{"type":53,"tag":81,"props":1320,"children":1321},{"style":104},[1322],{"type":59,"value":128},{"type":53,"tag":81,"props":1324,"children":1325},{"style":131},[1326],{"type":59,"value":1327},"Katt",{"type":53,"tag":81,"props":1329,"children":1330},{"style":104},[1331],{"type":59,"value":139},{"type":53,"tag":81,"props":1333,"children":1334},{"style":104},[1335],{"type":59,"value":1336}," };\n",{"type":53,"tag":81,"props":1338,"children":1340},{"class":83,"line":1339},22,[1341,1346],{"type":53,"tag":81,"props":1342,"children":1343},{"style":98},[1344],{"type":59,"value":1345},"  return",{"type":53,"tag":81,"props":1347,"children":1348},{"style":104},[1349],{"type":59,"value":1350}," null;\n",{"type":53,"tag":81,"props":1352,"children":1354},{"class":83,"line":1353},23,[1355],{"type":53,"tag":81,"props":1356,"children":1357},{"style":104},[1358],{"type":59,"value":1359},"}\n",{"type":53,"tag":625,"props":1361,"children":1363},{"id":1362},"wrapping-original-errors-with-cause",[1364],{"type":59,"value":1365},"Wrapping original errors with cause",{"type":53,"tag":69,"props":1367,"children":1369},{"className":71,"code":1368,"language":73,"meta":74,"style":74},"import { TRPCError } from '@trpc\u002Fserver';\nimport { publicProcedure, router } from '.\u002Ftrpc';\n\nexport const appRouter = router({\n  riskyOperation: publicProcedure.mutation(async () => {\n    try {\n      return await externalService();\n    } catch (err) {\n      throw new TRPCError({\n        code: 'INTERNAL_SERVER_ERROR',\n        message: 'An unexpected error occurred, please try again later.',\n        cause: err,\n      });\n    }\n  }),\n});\n\nasync function externalService() {\n  throw new Error('connection refused');\n}\n",[1370],{"type":53,"tag":77,"props":1371,"children":1372},{"__ignoreMap":74},[1373,1412,1459,1466,1497,1544,1556,1582,1611,1635,1664,1693,1714,1730,1738,1754,1769,1776,1800,1842],{"type":53,"tag":81,"props":1374,"children":1375},{"class":83,"line":84},[1376,1380,1384,1388,1392,1396,1400,1404,1408],{"type":53,"tag":81,"props":1377,"children":1378},{"style":98},[1379],{"type":59,"value":101},{"type":53,"tag":81,"props":1381,"children":1382},{"style":104},[1383],{"type":59,"value":107},{"type":53,"tag":81,"props":1385,"children":1386},{"style":110},[1387],{"type":59,"value":653},{"type":53,"tag":81,"props":1389,"children":1390},{"style":104},[1391],{"type":59,"value":118},{"type":53,"tag":81,"props":1393,"children":1394},{"style":98},[1395],{"type":59,"value":123},{"type":53,"tag":81,"props":1397,"children":1398},{"style":104},[1399],{"type":59,"value":128},{"type":53,"tag":81,"props":1401,"children":1402},{"style":131},[1403],{"type":59,"value":134},{"type":53,"tag":81,"props":1405,"children":1406},{"style":104},[1407],{"type":59,"value":139},{"type":53,"tag":81,"props":1409,"children":1410},{"style":104},[1411],{"type":59,"value":144},{"type":53,"tag":81,"props":1413,"children":1414},{"class":83,"line":94},[1415,1419,1423,1427,1431,1435,1439,1443,1447,1451,1455],{"type":53,"tag":81,"props":1416,"children":1417},{"style":98},[1418],{"type":59,"value":101},{"type":53,"tag":81,"props":1420,"children":1421},{"style":104},[1422],{"type":59,"value":107},{"type":53,"tag":81,"props":1424,"children":1425},{"style":110},[1426],{"type":59,"value":733},{"type":53,"tag":81,"props":1428,"children":1429},{"style":104},[1430],{"type":59,"value":267},{"type":53,"tag":81,"props":1432,"children":1433},{"style":110},[1434],{"type":59,"value":742},{"type":53,"tag":81,"props":1436,"children":1437},{"style":104},[1438],{"type":59,"value":118},{"type":53,"tag":81,"props":1440,"children":1441},{"style":98},[1442],{"type":59,"value":123},{"type":53,"tag":81,"props":1444,"children":1445},{"style":104},[1446],{"type":59,"value":128},{"type":53,"tag":81,"props":1448,"children":1449},{"style":131},[1450],{"type":59,"value":759},{"type":53,"tag":81,"props":1452,"children":1453},{"style":104},[1454],{"type":59,"value":139},{"type":53,"tag":81,"props":1456,"children":1457},{"style":104},[1458],{"type":59,"value":144},{"type":53,"tag":81,"props":1460,"children":1461},{"class":83,"line":147},[1462],{"type":53,"tag":81,"props":1463,"children":1464},{"emptyLinePlaceholder":193},[1465],{"type":59,"value":196},{"type":53,"tag":81,"props":1467,"children":1468},{"class":83,"line":189},[1469,1473,1477,1481,1485,1489,1493],{"type":53,"tag":81,"props":1470,"children":1471},{"style":98},[1472],{"type":59,"value":547},{"type":53,"tag":81,"props":1474,"children":1475},{"style":203},[1476],{"type":59,"value":552},{"type":53,"tag":81,"props":1478,"children":1479},{"style":110},[1480],{"type":59,"value":790},{"type":53,"tag":81,"props":1482,"children":1483},{"style":104},[1484],{"type":59,"value":216},{"type":53,"tag":81,"props":1486,"children":1487},{"style":228},[1488],{"type":59,"value":742},{"type":53,"tag":81,"props":1490,"children":1491},{"style":110},[1492],{"type":59,"value":236},{"type":53,"tag":81,"props":1494,"children":1495},{"style":104},[1496],{"type":59,"value":241},{"type":53,"tag":81,"props":1498,"children":1499},{"class":83,"line":199},[1500,1505,1509,1513,1517,1522,1526,1531,1536,1540],{"type":53,"tag":81,"props":1501,"children":1502},{"style":248},[1503],{"type":59,"value":1504},"  riskyOperation",{"type":53,"tag":81,"props":1506,"children":1507},{"style":104},[1508],{"type":59,"value":328},{"type":53,"tag":81,"props":1510,"children":1511},{"style":110},[1512],{"type":59,"value":733},{"type":53,"tag":81,"props":1514,"children":1515},{"style":104},[1516],{"type":59,"value":225},{"type":53,"tag":81,"props":1518,"children":1519},{"style":228},[1520],{"type":59,"value":1521},"mutation",{"type":53,"tag":81,"props":1523,"children":1524},{"style":110},[1525],{"type":59,"value":236},{"type":53,"tag":81,"props":1527,"children":1528},{"style":203},[1529],{"type":59,"value":1530},"async",{"type":53,"tag":81,"props":1532,"children":1533},{"style":104},[1534],{"type":59,"value":1535}," ()",{"type":53,"tag":81,"props":1537,"children":1538},{"style":203},[1539],{"type":59,"value":929},{"type":53,"tag":81,"props":1541,"children":1542},{"style":104},[1543],{"type":59,"value":282},{"type":53,"tag":81,"props":1545,"children":1546},{"class":83,"line":244},[1547,1552],{"type":53,"tag":81,"props":1548,"children":1549},{"style":98},[1550],{"type":59,"value":1551},"    try",{"type":53,"tag":81,"props":1553,"children":1554},{"style":104},[1555],{"type":59,"value":282},{"type":53,"tag":81,"props":1557,"children":1558},{"class":83,"line":285},[1559,1563,1568,1573,1578],{"type":53,"tag":81,"props":1560,"children":1561},{"style":98},[1562],{"type":59,"value":1156},{"type":53,"tag":81,"props":1564,"children":1565},{"style":98},[1566],{"type":59,"value":1567}," await",{"type":53,"tag":81,"props":1569,"children":1570},{"style":228},[1571],{"type":59,"value":1572}," externalService",{"type":53,"tag":81,"props":1574,"children":1575},{"style":248},[1576],{"type":59,"value":1577},"()",{"type":53,"tag":81,"props":1579,"children":1580},{"style":104},[1581],{"type":59,"value":144},{"type":53,"tag":81,"props":1583,"children":1584},{"class":83,"line":298},[1585,1589,1594,1598,1603,1607],{"type":53,"tag":81,"props":1586,"children":1587},{"style":104},[1588],{"type":59,"value":1172},{"type":53,"tag":81,"props":1590,"children":1591},{"style":98},[1592],{"type":59,"value":1593}," catch",{"type":53,"tag":81,"props":1595,"children":1596},{"style":248},[1597],{"type":59,"value":994},{"type":53,"tag":81,"props":1599,"children":1600},{"style":110},[1601],{"type":59,"value":1602},"err",{"type":53,"tag":81,"props":1604,"children":1605},{"style":248},[1606],{"type":59,"value":1009},{"type":53,"tag":81,"props":1608,"children":1609},{"style":104},[1610],{"type":59,"value":241},{"type":53,"tag":81,"props":1612,"children":1613},{"class":83,"line":317},[1614,1619,1623,1627,1631],{"type":53,"tag":81,"props":1615,"children":1616},{"style":98},[1617],{"type":59,"value":1618},"      throw",{"type":53,"tag":81,"props":1620,"children":1621},{"style":104},[1622],{"type":59,"value":1026},{"type":53,"tag":81,"props":1624,"children":1625},{"style":228},[1626],{"type":59,"value":653},{"type":53,"tag":81,"props":1628,"children":1629},{"style":248},[1630],{"type":59,"value":236},{"type":53,"tag":81,"props":1632,"children":1633},{"style":104},[1634],{"type":59,"value":241},{"type":53,"tag":81,"props":1636,"children":1637},{"class":83,"line":335},[1638,1643,1647,1651,1656,1660],{"type":53,"tag":81,"props":1639,"children":1640},{"style":248},[1641],{"type":59,"value":1642},"        code",{"type":53,"tag":81,"props":1644,"children":1645},{"style":104},[1646],{"type":59,"value":328},{"type":53,"tag":81,"props":1648,"children":1649},{"style":104},[1650],{"type":59,"value":128},{"type":53,"tag":81,"props":1652,"children":1653},{"style":131},[1654],{"type":59,"value":1655},"INTERNAL_SERVER_ERROR",{"type":53,"tag":81,"props":1657,"children":1658},{"style":104},[1659],{"type":59,"value":139},{"type":53,"tag":81,"props":1661,"children":1662},{"style":104},[1663],{"type":59,"value":314},{"type":53,"tag":81,"props":1665,"children":1666},{"class":83,"line":361},[1667,1672,1676,1680,1685,1689],{"type":53,"tag":81,"props":1668,"children":1669},{"style":248},[1670],{"type":59,"value":1671},"        message",{"type":53,"tag":81,"props":1673,"children":1674},{"style":104},[1675],{"type":59,"value":328},{"type":53,"tag":81,"props":1677,"children":1678},{"style":104},[1679],{"type":59,"value":128},{"type":53,"tag":81,"props":1681,"children":1682},{"style":131},[1683],{"type":59,"value":1684},"An unexpected error occurred, please try again later.",{"type":53,"tag":81,"props":1686,"children":1687},{"style":104},[1688],{"type":59,"value":139},{"type":53,"tag":81,"props":1690,"children":1691},{"style":104},[1692],{"type":59,"value":314},{"type":53,"tag":81,"props":1694,"children":1695},{"class":83,"line":375},[1696,1701,1705,1710],{"type":53,"tag":81,"props":1697,"children":1698},{"style":248},[1699],{"type":59,"value":1700},"        cause",{"type":53,"tag":81,"props":1702,"children":1703},{"style":104},[1704],{"type":59,"value":328},{"type":53,"tag":81,"props":1706,"children":1707},{"style":110},[1708],{"type":59,"value":1709}," err",{"type":53,"tag":81,"props":1711,"children":1712},{"style":104},[1713],{"type":59,"value":314},{"type":53,"tag":81,"props":1715,"children":1716},{"class":83,"line":439},[1717,1722,1726],{"type":53,"tag":81,"props":1718,"children":1719},{"style":104},[1720],{"type":59,"value":1721},"      }",{"type":53,"tag":81,"props":1723,"children":1724},{"style":248},[1725],{"type":59,"value":526},{"type":53,"tag":81,"props":1727,"children":1728},{"style":104},[1729],{"type":59,"value":144},{"type":53,"tag":81,"props":1731,"children":1732},{"class":83,"line":474},[1733],{"type":53,"tag":81,"props":1734,"children":1735},{"style":104},[1736],{"type":59,"value":1737},"    }\n",{"type":53,"tag":81,"props":1739,"children":1740},{"class":83,"line":488},[1741,1746,1750],{"type":53,"tag":81,"props":1742,"children":1743},{"style":104},[1744],{"type":59,"value":1745},"  }",{"type":53,"tag":81,"props":1747,"children":1748},{"style":110},[1749],{"type":59,"value":526},{"type":53,"tag":81,"props":1751,"children":1752},{"style":104},[1753],{"type":59,"value":314},{"type":53,"tag":81,"props":1755,"children":1756},{"class":83,"line":497},[1757,1761,1765],{"type":53,"tag":81,"props":1758,"children":1759},{"style":104},[1760],{"type":59,"value":521},{"type":53,"tag":81,"props":1762,"children":1763},{"style":110},[1764],{"type":59,"value":526},{"type":53,"tag":81,"props":1766,"children":1767},{"style":104},[1768],{"type":59,"value":144},{"type":53,"tag":81,"props":1770,"children":1771},{"class":83,"line":506},[1772],{"type":53,"tag":81,"props":1773,"children":1774},{"emptyLinePlaceholder":193},[1775],{"type":59,"value":196},{"type":53,"tag":81,"props":1777,"children":1778},{"class":83,"line":515},[1779,1783,1788,1792,1796],{"type":53,"tag":81,"props":1780,"children":1781},{"style":203},[1782],{"type":59,"value":1530},{"type":53,"tag":81,"props":1784,"children":1785},{"style":203},[1786],{"type":59,"value":1787}," function",{"type":53,"tag":81,"props":1789,"children":1790},{"style":228},[1791],{"type":59,"value":1572},{"type":53,"tag":81,"props":1793,"children":1794},{"style":104},[1795],{"type":59,"value":1577},{"type":53,"tag":81,"props":1797,"children":1798},{"style":104},[1799],{"type":59,"value":282},{"type":53,"tag":81,"props":1801,"children":1802},{"class":83,"line":533},[1803,1808,1812,1817,1821,1825,1830,1834,1838],{"type":53,"tag":81,"props":1804,"children":1805},{"style":98},[1806],{"type":59,"value":1807},"  throw",{"type":53,"tag":81,"props":1809,"children":1810},{"style":104},[1811],{"type":59,"value":1026},{"type":53,"tag":81,"props":1813,"children":1814},{"style":228},[1815],{"type":59,"value":1816}," Error",{"type":53,"tag":81,"props":1818,"children":1819},{"style":248},[1820],{"type":59,"value":236},{"type":53,"tag":81,"props":1822,"children":1823},{"style":104},[1824],{"type":59,"value":139},{"type":53,"tag":81,"props":1826,"children":1827},{"style":131},[1828],{"type":59,"value":1829},"connection refused",{"type":53,"tag":81,"props":1831,"children":1832},{"style":104},[1833],{"type":59,"value":139},{"type":53,"tag":81,"props":1835,"children":1836},{"style":248},[1837],{"type":59,"value":526},{"type":53,"tag":81,"props":1839,"children":1840},{"style":104},[1841],{"type":59,"value":144},{"type":53,"tag":81,"props":1843,"children":1844},{"class":83,"line":541},[1845],{"type":53,"tag":81,"props":1846,"children":1847},{"style":104},[1848],{"type":59,"value":1359},{"type":53,"tag":1850,"props":1851,"children":1852},"p",{},[1853,1855,1860],{"type":59,"value":1854},"Pass the original error as ",{"type":53,"tag":77,"props":1856,"children":1858},{"className":1857},[],[1859],{"type":59,"value":425},{"type":59,"value":1861}," to retain the stack trace for debugging.",{"type":53,"tag":625,"props":1863,"children":1865},{"id":1864},"global-error-handling-with-onerror",[1866],{"type":59,"value":1867},"Global error handling with onError",{"type":53,"tag":69,"props":1869,"children":1871},{"className":71,"code":1870,"language":73,"meta":74,"style":74},"import { createHTTPServer } from '@trpc\u002Fserver\u002Fadapters\u002Fstandalone';\nimport { appRouter } from '.\u002FappRouter';\n\nconst server = createHTTPServer({\n  router: appRouter,\n  onError(opts) {\n    const { error, type, path, input, ctx, req } = opts;\n    console.error('Error:', error);\n    if (error.code === 'INTERNAL_SERVER_ERROR') {\n      \u002F\u002F send to bug reporting service\n    }\n  },\n});\n\nserver.listen(3000);\n",[1872],{"type":53,"tag":77,"props":1873,"children":1874},{"__ignoreMap":74},[1875,1916,1957,1964,1992,2012,2037,2114,2164,2212,2220,2227,2234,2249,2256],{"type":53,"tag":81,"props":1876,"children":1877},{"class":83,"line":84},[1878,1882,1886,1891,1895,1899,1903,1908,1912],{"type":53,"tag":81,"props":1879,"children":1880},{"style":98},[1881],{"type":59,"value":101},{"type":53,"tag":81,"props":1883,"children":1884},{"style":104},[1885],{"type":59,"value":107},{"type":53,"tag":81,"props":1887,"children":1888},{"style":110},[1889],{"type":59,"value":1890}," createHTTPServer",{"type":53,"tag":81,"props":1892,"children":1893},{"style":104},[1894],{"type":59,"value":118},{"type":53,"tag":81,"props":1896,"children":1897},{"style":98},[1898],{"type":59,"value":123},{"type":53,"tag":81,"props":1900,"children":1901},{"style":104},[1902],{"type":59,"value":128},{"type":53,"tag":81,"props":1904,"children":1905},{"style":131},[1906],{"type":59,"value":1907},"@trpc\u002Fserver\u002Fadapters\u002Fstandalone",{"type":53,"tag":81,"props":1909,"children":1910},{"style":104},[1911],{"type":59,"value":139},{"type":53,"tag":81,"props":1913,"children":1914},{"style":104},[1915],{"type":59,"value":144},{"type":53,"tag":81,"props":1917,"children":1918},{"class":83,"line":94},[1919,1923,1927,1932,1936,1940,1944,1949,1953],{"type":53,"tag":81,"props":1920,"children":1921},{"style":98},[1922],{"type":59,"value":101},{"type":53,"tag":81,"props":1924,"children":1925},{"style":104},[1926],{"type":59,"value":107},{"type":53,"tag":81,"props":1928,"children":1929},{"style":110},[1930],{"type":59,"value":1931}," appRouter",{"type":53,"tag":81,"props":1933,"children":1934},{"style":104},[1935],{"type":59,"value":118},{"type":53,"tag":81,"props":1937,"children":1938},{"style":98},[1939],{"type":59,"value":123},{"type":53,"tag":81,"props":1941,"children":1942},{"style":104},[1943],{"type":59,"value":128},{"type":53,"tag":81,"props":1945,"children":1946},{"style":131},[1947],{"type":59,"value":1948},".\u002FappRouter",{"type":53,"tag":81,"props":1950,"children":1951},{"style":104},[1952],{"type":59,"value":139},{"type":53,"tag":81,"props":1954,"children":1955},{"style":104},[1956],{"type":59,"value":144},{"type":53,"tag":81,"props":1958,"children":1959},{"class":83,"line":147},[1960],{"type":53,"tag":81,"props":1961,"children":1962},{"emptyLinePlaceholder":193},[1963],{"type":59,"value":196},{"type":53,"tag":81,"props":1965,"children":1966},{"class":83,"line":189},[1967,1971,1976,1980,1984,1988],{"type":53,"tag":81,"props":1968,"children":1969},{"style":203},[1970],{"type":59,"value":206},{"type":53,"tag":81,"props":1972,"children":1973},{"style":110},[1974],{"type":59,"value":1975}," server ",{"type":53,"tag":81,"props":1977,"children":1978},{"style":104},[1979],{"type":59,"value":216},{"type":53,"tag":81,"props":1981,"children":1982},{"style":228},[1983],{"type":59,"value":1890},{"type":53,"tag":81,"props":1985,"children":1986},{"style":110},[1987],{"type":59,"value":236},{"type":53,"tag":81,"props":1989,"children":1990},{"style":104},[1991],{"type":59,"value":241},{"type":53,"tag":81,"props":1993,"children":1994},{"class":83,"line":199},[1995,2000,2004,2008],{"type":53,"tag":81,"props":1996,"children":1997},{"style":248},[1998],{"type":59,"value":1999},"  router",{"type":53,"tag":81,"props":2001,"children":2002},{"style":104},[2003],{"type":59,"value":328},{"type":53,"tag":81,"props":2005,"children":2006},{"style":110},[2007],{"type":59,"value":1931},{"type":53,"tag":81,"props":2009,"children":2010},{"style":104},[2011],{"type":59,"value":314},{"type":53,"tag":81,"props":2013,"children":2014},{"class":83,"line":244},[2015,2020,2024,2029,2033],{"type":53,"tag":81,"props":2016,"children":2017},{"style":248},[2018],{"type":59,"value":2019},"  onError",{"type":53,"tag":81,"props":2021,"children":2022},{"style":104},[2023],{"type":59,"value":236},{"type":53,"tag":81,"props":2025,"children":2026},{"style":259},[2027],{"type":59,"value":2028},"opts",{"type":53,"tag":81,"props":2030,"children":2031},{"style":104},[2032],{"type":59,"value":526},{"type":53,"tag":81,"props":2034,"children":2035},{"style":104},[2036],{"type":59,"value":282},{"type":53,"tag":81,"props":2038,"children":2039},{"class":83,"line":285},[2040,2045,2049,2053,2057,2062,2066,2071,2075,2079,2083,2088,2092,2097,2101,2105,2110],{"type":53,"tag":81,"props":2041,"children":2042},{"style":203},[2043],{"type":59,"value":2044},"    const",{"type":53,"tag":81,"props":2046,"children":2047},{"style":104},[2048],{"type":59,"value":107},{"type":53,"tag":81,"props":2050,"children":2051},{"style":110},[2052],{"type":59,"value":272},{"type":53,"tag":81,"props":2054,"children":2055},{"style":104},[2056],{"type":59,"value":267},{"type":53,"tag":81,"props":2058,"children":2059},{"style":110},[2060],{"type":59,"value":2061}," type",{"type":53,"tag":81,"props":2063,"children":2064},{"style":104},[2065],{"type":59,"value":267},{"type":53,"tag":81,"props":2067,"children":2068},{"style":110},[2069],{"type":59,"value":2070}," path",{"type":53,"tag":81,"props":2072,"children":2073},{"style":104},[2074],{"type":59,"value":267},{"type":53,"tag":81,"props":2076,"children":2077},{"style":110},[2078],{"type":59,"value":920},{"type":53,"tag":81,"props":2080,"children":2081},{"style":104},[2082],{"type":59,"value":267},{"type":53,"tag":81,"props":2084,"children":2085},{"style":110},[2086],{"type":59,"value":2087}," ctx",{"type":53,"tag":81,"props":2089,"children":2090},{"style":104},[2091],{"type":59,"value":267},{"type":53,"tag":81,"props":2093,"children":2094},{"style":110},[2095],{"type":59,"value":2096}," req",{"type":53,"tag":81,"props":2098,"children":2099},{"style":104},[2100],{"type":59,"value":118},{"type":53,"tag":81,"props":2102,"children":2103},{"style":104},[2104],{"type":59,"value":951},{"type":53,"tag":81,"props":2106,"children":2107},{"style":110},[2108],{"type":59,"value":2109}," opts",{"type":53,"tag":81,"props":2111,"children":2112},{"style":104},[2113],{"type":59,"value":144},{"type":53,"tag":81,"props":2115,"children":2116},{"class":83,"line":298},[2117,2122,2126,2131,2135,2139,2144,2148,2152,2156,2160],{"type":53,"tag":81,"props":2118,"children":2119},{"style":110},[2120],{"type":59,"value":2121},"    console",{"type":53,"tag":81,"props":2123,"children":2124},{"style":104},[2125],{"type":59,"value":225},{"type":53,"tag":81,"props":2127,"children":2128},{"style":228},[2129],{"type":59,"value":2130},"error",{"type":53,"tag":81,"props":2132,"children":2133},{"style":248},[2134],{"type":59,"value":236},{"type":53,"tag":81,"props":2136,"children":2137},{"style":104},[2138],{"type":59,"value":139},{"type":53,"tag":81,"props":2140,"children":2141},{"style":131},[2142],{"type":59,"value":2143},"Error:",{"type":53,"tag":81,"props":2145,"children":2146},{"style":104},[2147],{"type":59,"value":139},{"type":53,"tag":81,"props":2149,"children":2150},{"style":104},[2151],{"type":59,"value":267},{"type":53,"tag":81,"props":2153,"children":2154},{"style":110},[2155],{"type":59,"value":272},{"type":53,"tag":81,"props":2157,"children":2158},{"style":248},[2159],{"type":59,"value":526},{"type":53,"tag":81,"props":2161,"children":2162},{"style":104},[2163],{"type":59,"value":144},{"type":53,"tag":81,"props":2165,"children":2166},{"class":83,"line":317},[2167,2172,2176,2180,2184,2188,2192,2196,2200,2204,2208],{"type":53,"tag":81,"props":2168,"children":2169},{"style":98},[2170],{"type":59,"value":2171},"    if",{"type":53,"tag":81,"props":2173,"children":2174},{"style":248},[2175],{"type":59,"value":994},{"type":53,"tag":81,"props":2177,"children":2178},{"style":110},[2179],{"type":59,"value":2130},{"type":53,"tag":81,"props":2181,"children":2182},{"style":104},[2183],{"type":59,"value":225},{"type":53,"tag":81,"props":2185,"children":2186},{"style":110},[2187],{"type":59,"value":77},{"type":53,"tag":81,"props":2189,"children":2190},{"style":104},[2191],{"type":59,"value":394},{"type":53,"tag":81,"props":2193,"children":2194},{"style":104},[2195],{"type":59,"value":128},{"type":53,"tag":81,"props":2197,"children":2198},{"style":131},[2199],{"type":59,"value":1655},{"type":53,"tag":81,"props":2201,"children":2202},{"style":104},[2203],{"type":59,"value":139},{"type":53,"tag":81,"props":2205,"children":2206},{"style":248},[2207],{"type":59,"value":1009},{"type":53,"tag":81,"props":2209,"children":2210},{"style":104},[2211],{"type":59,"value":241},{"type":53,"tag":81,"props":2213,"children":2214},{"class":83,"line":335},[2215],{"type":53,"tag":81,"props":2216,"children":2217},{"style":88},[2218],{"type":59,"value":2219},"      \u002F\u002F send to bug reporting service\n",{"type":53,"tag":81,"props":2221,"children":2222},{"class":83,"line":361},[2223],{"type":53,"tag":81,"props":2224,"children":2225},{"style":104},[2226],{"type":59,"value":1737},{"type":53,"tag":81,"props":2228,"children":2229},{"class":83,"line":375},[2230],{"type":53,"tag":81,"props":2231,"children":2232},{"style":104},[2233],{"type":59,"value":512},{"type":53,"tag":81,"props":2235,"children":2236},{"class":83,"line":439},[2237,2241,2245],{"type":53,"tag":81,"props":2238,"children":2239},{"style":104},[2240],{"type":59,"value":521},{"type":53,"tag":81,"props":2242,"children":2243},{"style":110},[2244],{"type":59,"value":526},{"type":53,"tag":81,"props":2246,"children":2247},{"style":104},[2248],{"type":59,"value":144},{"type":53,"tag":81,"props":2250,"children":2251},{"class":83,"line":474},[2252],{"type":53,"tag":81,"props":2253,"children":2254},{"emptyLinePlaceholder":193},[2255],{"type":59,"value":196},{"type":53,"tag":81,"props":2257,"children":2258},{"class":83,"line":488},[2259,2264,2268,2273,2277,2283,2287],{"type":53,"tag":81,"props":2260,"children":2261},{"style":110},[2262],{"type":59,"value":2263},"server",{"type":53,"tag":81,"props":2265,"children":2266},{"style":104},[2267],{"type":59,"value":225},{"type":53,"tag":81,"props":2269,"children":2270},{"style":228},[2271],{"type":59,"value":2272},"listen",{"type":53,"tag":81,"props":2274,"children":2275},{"style":110},[2276],{"type":59,"value":236},{"type":53,"tag":81,"props":2278,"children":2280},{"style":2279},"--shiki-light:#F76D47;--shiki-default:#F78C6C;--shiki-dark:#F78C6C",[2281],{"type":59,"value":2282},"3000",{"type":53,"tag":81,"props":2284,"children":2285},{"style":110},[2286],{"type":59,"value":526},{"type":53,"tag":81,"props":2288,"children":2289},{"style":104},[2290],{"type":59,"value":144},{"type":53,"tag":625,"props":2292,"children":2294},{"id":2293},"extracting-http-status-from-trpcerror",[2295],{"type":59,"value":2296},"Extracting HTTP status from TRPCError",{"type":53,"tag":69,"props":2298,"children":2300},{"className":71,"code":2299,"language":73,"meta":74,"style":74},"import { TRPCError } from '@trpc\u002Fserver';\nimport { getHTTPStatusCodeFromError } from '@trpc\u002Fserver\u002Fhttp';\n\nfunction handleError(error: unknown) {\n  if (error instanceof TRPCError) {\n    const httpCode = getHTTPStatusCodeFromError(error);\n    console.log(httpCode); \u002F\u002F e.g., 400, 401, 404, 500\n  }\n}\n",[2301],{"type":53,"tag":77,"props":2302,"children":2303},{"__ignoreMap":74},[2304,2343,2384,2391,2428,2459,2495,2534,2542],{"type":53,"tag":81,"props":2305,"children":2306},{"class":83,"line":84},[2307,2311,2315,2319,2323,2327,2331,2335,2339],{"type":53,"tag":81,"props":2308,"children":2309},{"style":98},[2310],{"type":59,"value":101},{"type":53,"tag":81,"props":2312,"children":2313},{"style":104},[2314],{"type":59,"value":107},{"type":53,"tag":81,"props":2316,"children":2317},{"style":110},[2318],{"type":59,"value":653},{"type":53,"tag":81,"props":2320,"children":2321},{"style":104},[2322],{"type":59,"value":118},{"type":53,"tag":81,"props":2324,"children":2325},{"style":98},[2326],{"type":59,"value":123},{"type":53,"tag":81,"props":2328,"children":2329},{"style":104},[2330],{"type":59,"value":128},{"type":53,"tag":81,"props":2332,"children":2333},{"style":131},[2334],{"type":59,"value":134},{"type":53,"tag":81,"props":2336,"children":2337},{"style":104},[2338],{"type":59,"value":139},{"type":53,"tag":81,"props":2340,"children":2341},{"style":104},[2342],{"type":59,"value":144},{"type":53,"tag":81,"props":2344,"children":2345},{"class":83,"line":94},[2346,2350,2354,2359,2363,2367,2371,2376,2380],{"type":53,"tag":81,"props":2347,"children":2348},{"style":98},[2349],{"type":59,"value":101},{"type":53,"tag":81,"props":2351,"children":2352},{"style":104},[2353],{"type":59,"value":107},{"type":53,"tag":81,"props":2355,"children":2356},{"style":110},[2357],{"type":59,"value":2358}," getHTTPStatusCodeFromError",{"type":53,"tag":81,"props":2360,"children":2361},{"style":104},[2362],{"type":59,"value":118},{"type":53,"tag":81,"props":2364,"children":2365},{"style":98},[2366],{"type":59,"value":123},{"type":53,"tag":81,"props":2368,"children":2369},{"style":104},[2370],{"type":59,"value":128},{"type":53,"tag":81,"props":2372,"children":2373},{"style":131},[2374],{"type":59,"value":2375},"@trpc\u002Fserver\u002Fhttp",{"type":53,"tag":81,"props":2377,"children":2378},{"style":104},[2379],{"type":59,"value":139},{"type":53,"tag":81,"props":2381,"children":2382},{"style":104},[2383],{"type":59,"value":144},{"type":53,"tag":81,"props":2385,"children":2386},{"class":83,"line":147},[2387],{"type":53,"tag":81,"props":2388,"children":2389},{"emptyLinePlaceholder":193},[2390],{"type":59,"value":196},{"type":53,"tag":81,"props":2392,"children":2393},{"class":83,"line":189},[2394,2398,2403,2407,2411,2415,2420,2424],{"type":53,"tag":81,"props":2395,"children":2396},{"style":203},[2397],{"type":59,"value":1210},{"type":53,"tag":81,"props":2399,"children":2400},{"style":228},[2401],{"type":59,"value":2402}," handleError",{"type":53,"tag":81,"props":2404,"children":2405},{"style":104},[2406],{"type":59,"value":236},{"type":53,"tag":81,"props":2408,"children":2409},{"style":259},[2410],{"type":59,"value":2130},{"type":53,"tag":81,"props":2412,"children":2413},{"style":104},[2414],{"type":59,"value":328},{"type":53,"tag":81,"props":2416,"children":2417},{"style":433},[2418],{"type":59,"value":2419}," unknown",{"type":53,"tag":81,"props":2421,"children":2422},{"style":104},[2423],{"type":59,"value":526},{"type":53,"tag":81,"props":2425,"children":2426},{"style":104},[2427],{"type":59,"value":282},{"type":53,"tag":81,"props":2429,"children":2430},{"class":83,"line":199},[2431,2435,2439,2443,2447,2451,2455],{"type":53,"tag":81,"props":2432,"children":2433},{"style":98},[2434],{"type":59,"value":1247},{"type":53,"tag":81,"props":2436,"children":2437},{"style":248},[2438],{"type":59,"value":994},{"type":53,"tag":81,"props":2440,"children":2441},{"style":110},[2442],{"type":59,"value":2130},{"type":53,"tag":81,"props":2444,"children":2445},{"style":104},[2446],{"type":59,"value":430},{"type":53,"tag":81,"props":2448,"children":2449},{"style":433},[2450],{"type":59,"value":653},{"type":53,"tag":81,"props":2452,"children":2453},{"style":248},[2454],{"type":59,"value":1009},{"type":53,"tag":81,"props":2456,"children":2457},{"style":104},[2458],{"type":59,"value":241},{"type":53,"tag":81,"props":2460,"children":2461},{"class":83,"line":244},[2462,2466,2471,2475,2479,2483,2487,2491],{"type":53,"tag":81,"props":2463,"children":2464},{"style":203},[2465],{"type":59,"value":2044},{"type":53,"tag":81,"props":2467,"children":2468},{"style":110},[2469],{"type":59,"value":2470}," httpCode",{"type":53,"tag":81,"props":2472,"children":2473},{"style":104},[2474],{"type":59,"value":951},{"type":53,"tag":81,"props":2476,"children":2477},{"style":228},[2478],{"type":59,"value":2358},{"type":53,"tag":81,"props":2480,"children":2481},{"style":248},[2482],{"type":59,"value":236},{"type":53,"tag":81,"props":2484,"children":2485},{"style":110},[2486],{"type":59,"value":2130},{"type":53,"tag":81,"props":2488,"children":2489},{"style":248},[2490],{"type":59,"value":526},{"type":53,"tag":81,"props":2492,"children":2493},{"style":104},[2494],{"type":59,"value":144},{"type":53,"tag":81,"props":2496,"children":2497},{"class":83,"line":285},[2498,2502,2506,2511,2515,2520,2524,2529],{"type":53,"tag":81,"props":2499,"children":2500},{"style":110},[2501],{"type":59,"value":2121},{"type":53,"tag":81,"props":2503,"children":2504},{"style":104},[2505],{"type":59,"value":225},{"type":53,"tag":81,"props":2507,"children":2508},{"style":228},[2509],{"type":59,"value":2510},"log",{"type":53,"tag":81,"props":2512,"children":2513},{"style":248},[2514],{"type":59,"value":236},{"type":53,"tag":81,"props":2516,"children":2517},{"style":110},[2518],{"type":59,"value":2519},"httpCode",{"type":53,"tag":81,"props":2521,"children":2522},{"style":248},[2523],{"type":59,"value":526},{"type":53,"tag":81,"props":2525,"children":2526},{"style":104},[2527],{"type":59,"value":2528},";",{"type":53,"tag":81,"props":2530,"children":2531},{"style":88},[2532],{"type":59,"value":2533}," \u002F\u002F e.g., 400, 401, 404, 500\n",{"type":53,"tag":81,"props":2535,"children":2536},{"class":83,"line":298},[2537],{"type":53,"tag":81,"props":2538,"children":2539},{"style":104},[2540],{"type":59,"value":2541},"  }\n",{"type":53,"tag":81,"props":2543,"children":2544},{"class":83,"line":317},[2545],{"type":53,"tag":81,"props":2546,"children":2547},{"style":104},[2548],{"type":59,"value":1359},{"type":53,"tag":62,"props":2550,"children":2552},{"id":2551},"common-mistakes",[2553],{"type":59,"value":2554},"Common Mistakes",{"type":53,"tag":625,"props":2556,"children":2558},{"id":2557},"high-throwing-plain-error-instead-of-trpcerror",[2559,2564],{"type":53,"tag":81,"props":2560,"children":2561},{},[2562],{"type":59,"value":2563},"HIGH",{"type":59,"value":2565}," Throwing plain Error instead of TRPCError",{"type":53,"tag":1850,"props":2567,"children":2568},{},[2569],{"type":59,"value":2570},"Wrong:",{"type":53,"tag":69,"props":2572,"children":2574},{"className":71,"code":2573,"language":73,"meta":74,"style":74},"import { publicProcedure } from '.\u002Ftrpc';\n\nconst proc = publicProcedure.query(() => {\n  throw new Error('Not found');\n  \u002F\u002F client receives 500 INTERNAL_SERVER_ERROR\n});\n",[2575],{"type":53,"tag":77,"props":2576,"children":2577},{"__ignoreMap":74},[2578,2617,2624,2668,2708,2716],{"type":53,"tag":81,"props":2579,"children":2580},{"class":83,"line":84},[2581,2585,2589,2593,2597,2601,2605,2609,2613],{"type":53,"tag":81,"props":2582,"children":2583},{"style":98},[2584],{"type":59,"value":101},{"type":53,"tag":81,"props":2586,"children":2587},{"style":104},[2588],{"type":59,"value":107},{"type":53,"tag":81,"props":2590,"children":2591},{"style":110},[2592],{"type":59,"value":733},{"type":53,"tag":81,"props":2594,"children":2595},{"style":104},[2596],{"type":59,"value":118},{"type":53,"tag":81,"props":2598,"children":2599},{"style":98},[2600],{"type":59,"value":123},{"type":53,"tag":81,"props":2602,"children":2603},{"style":104},[2604],{"type":59,"value":128},{"type":53,"tag":81,"props":2606,"children":2607},{"style":131},[2608],{"type":59,"value":759},{"type":53,"tag":81,"props":2610,"children":2611},{"style":104},[2612],{"type":59,"value":139},{"type":53,"tag":81,"props":2614,"children":2615},{"style":104},[2616],{"type":59,"value":144},{"type":53,"tag":81,"props":2618,"children":2619},{"class":83,"line":94},[2620],{"type":53,"tag":81,"props":2621,"children":2622},{"emptyLinePlaceholder":193},[2623],{"type":59,"value":196},{"type":53,"tag":81,"props":2625,"children":2626},{"class":83,"line":147},[2627,2631,2636,2640,2644,2648,2652,2656,2660,2664],{"type":53,"tag":81,"props":2628,"children":2629},{"style":203},[2630],{"type":59,"value":206},{"type":53,"tag":81,"props":2632,"children":2633},{"style":110},[2634],{"type":59,"value":2635}," proc ",{"type":53,"tag":81,"props":2637,"children":2638},{"style":104},[2639],{"type":59,"value":216},{"type":53,"tag":81,"props":2641,"children":2642},{"style":110},[2643],{"type":59,"value":733},{"type":53,"tag":81,"props":2645,"children":2646},{"style":104},[2647],{"type":59,"value":225},{"type":53,"tag":81,"props":2649,"children":2650},{"style":228},[2651],{"type":59,"value":907},{"type":53,"tag":81,"props":2653,"children":2654},{"style":110},[2655],{"type":59,"value":236},{"type":53,"tag":81,"props":2657,"children":2658},{"style":104},[2659],{"type":59,"value":1577},{"type":53,"tag":81,"props":2661,"children":2662},{"style":203},[2663],{"type":59,"value":929},{"type":53,"tag":81,"props":2665,"children":2666},{"style":104},[2667],{"type":59,"value":282},{"type":53,"tag":81,"props":2669,"children":2670},{"class":83,"line":189},[2671,2675,2679,2683,2687,2691,2696,2700,2704],{"type":53,"tag":81,"props":2672,"children":2673},{"style":98},[2674],{"type":59,"value":1807},{"type":53,"tag":81,"props":2676,"children":2677},{"style":104},[2678],{"type":59,"value":1026},{"type":53,"tag":81,"props":2680,"children":2681},{"style":228},[2682],{"type":59,"value":1816},{"type":53,"tag":81,"props":2684,"children":2685},{"style":248},[2686],{"type":59,"value":236},{"type":53,"tag":81,"props":2688,"children":2689},{"style":104},[2690],{"type":59,"value":139},{"type":53,"tag":81,"props":2692,"children":2693},{"style":131},[2694],{"type":59,"value":2695},"Not found",{"type":53,"tag":81,"props":2697,"children":2698},{"style":104},[2699],{"type":59,"value":139},{"type":53,"tag":81,"props":2701,"children":2702},{"style":248},[2703],{"type":59,"value":526},{"type":53,"tag":81,"props":2705,"children":2706},{"style":104},[2707],{"type":59,"value":144},{"type":53,"tag":81,"props":2709,"children":2710},{"class":83,"line":199},[2711],{"type":53,"tag":81,"props":2712,"children":2713},{"style":88},[2714],{"type":59,"value":2715},"  \u002F\u002F client receives 500 INTERNAL_SERVER_ERROR\n",{"type":53,"tag":81,"props":2717,"children":2718},{"class":83,"line":244},[2719,2723,2727],{"type":53,"tag":81,"props":2720,"children":2721},{"style":104},[2722],{"type":59,"value":521},{"type":53,"tag":81,"props":2724,"children":2725},{"style":110},[2726],{"type":59,"value":526},{"type":53,"tag":81,"props":2728,"children":2729},{"style":104},[2730],{"type":59,"value":144},{"type":53,"tag":1850,"props":2732,"children":2733},{},[2734],{"type":59,"value":2735},"Correct:",{"type":53,"tag":69,"props":2737,"children":2739},{"className":71,"code":2738,"language":73,"meta":74,"style":74},"import { TRPCError } from '@trpc\u002Fserver';\nimport { publicProcedure } from '.\u002Ftrpc';\n\nconst proc = publicProcedure.query(() => {\n  throw new TRPCError({\n    code: 'NOT_FOUND',\n    message: 'User not found',\n  });\n  \u002F\u002F client receives 404 NOT_FOUND\n});\n",[2740],{"type":53,"tag":77,"props":2741,"children":2742},{"__ignoreMap":74},[2743,2782,2821,2828,2871,2894,2922,2951,2966,2974],{"type":53,"tag":81,"props":2744,"children":2745},{"class":83,"line":84},[2746,2750,2754,2758,2762,2766,2770,2774,2778],{"type":53,"tag":81,"props":2747,"children":2748},{"style":98},[2749],{"type":59,"value":101},{"type":53,"tag":81,"props":2751,"children":2752},{"style":104},[2753],{"type":59,"value":107},{"type":53,"tag":81,"props":2755,"children":2756},{"style":110},[2757],{"type":59,"value":653},{"type":53,"tag":81,"props":2759,"children":2760},{"style":104},[2761],{"type":59,"value":118},{"type":53,"tag":81,"props":2763,"children":2764},{"style":98},[2765],{"type":59,"value":123},{"type":53,"tag":81,"props":2767,"children":2768},{"style":104},[2769],{"type":59,"value":128},{"type":53,"tag":81,"props":2771,"children":2772},{"style":131},[2773],{"type":59,"value":134},{"type":53,"tag":81,"props":2775,"children":2776},{"style":104},[2777],{"type":59,"value":139},{"type":53,"tag":81,"props":2779,"children":2780},{"style":104},[2781],{"type":59,"value":144},{"type":53,"tag":81,"props":2783,"children":2784},{"class":83,"line":94},[2785,2789,2793,2797,2801,2805,2809,2813,2817],{"type":53,"tag":81,"props":2786,"children":2787},{"style":98},[2788],{"type":59,"value":101},{"type":53,"tag":81,"props":2790,"children":2791},{"style":104},[2792],{"type":59,"value":107},{"type":53,"tag":81,"props":2794,"children":2795},{"style":110},[2796],{"type":59,"value":733},{"type":53,"tag":81,"props":2798,"children":2799},{"style":104},[2800],{"type":59,"value":118},{"type":53,"tag":81,"props":2802,"children":2803},{"style":98},[2804],{"type":59,"value":123},{"type":53,"tag":81,"props":2806,"children":2807},{"style":104},[2808],{"type":59,"value":128},{"type":53,"tag":81,"props":2810,"children":2811},{"style":131},[2812],{"type":59,"value":759},{"type":53,"tag":81,"props":2814,"children":2815},{"style":104},[2816],{"type":59,"value":139},{"type":53,"tag":81,"props":2818,"children":2819},{"style":104},[2820],{"type":59,"value":144},{"type":53,"tag":81,"props":2822,"children":2823},{"class":83,"line":147},[2824],{"type":53,"tag":81,"props":2825,"children":2826},{"emptyLinePlaceholder":193},[2827],{"type":59,"value":196},{"type":53,"tag":81,"props":2829,"children":2830},{"class":83,"line":189},[2831,2835,2839,2843,2847,2851,2855,2859,2863,2867],{"type":53,"tag":81,"props":2832,"children":2833},{"style":203},[2834],{"type":59,"value":206},{"type":53,"tag":81,"props":2836,"children":2837},{"style":110},[2838],{"type":59,"value":2635},{"type":53,"tag":81,"props":2840,"children":2841},{"style":104},[2842],{"type":59,"value":216},{"type":53,"tag":81,"props":2844,"children":2845},{"style":110},[2846],{"type":59,"value":733},{"type":53,"tag":81,"props":2848,"children":2849},{"style":104},[2850],{"type":59,"value":225},{"type":53,"tag":81,"props":2852,"children":2853},{"style":228},[2854],{"type":59,"value":907},{"type":53,"tag":81,"props":2856,"children":2857},{"style":110},[2858],{"type":59,"value":236},{"type":53,"tag":81,"props":2860,"children":2861},{"style":104},[2862],{"type":59,"value":1577},{"type":53,"tag":81,"props":2864,"children":2865},{"style":203},[2866],{"type":59,"value":929},{"type":53,"tag":81,"props":2868,"children":2869},{"style":104},[2870],{"type":59,"value":282},{"type":53,"tag":81,"props":2872,"children":2873},{"class":83,"line":199},[2874,2878,2882,2886,2890],{"type":53,"tag":81,"props":2875,"children":2876},{"style":98},[2877],{"type":59,"value":1807},{"type":53,"tag":81,"props":2879,"children":2880},{"style":104},[2881],{"type":59,"value":1026},{"type":53,"tag":81,"props":2883,"children":2884},{"style":228},[2885],{"type":59,"value":653},{"type":53,"tag":81,"props":2887,"children":2888},{"style":248},[2889],{"type":59,"value":236},{"type":53,"tag":81,"props":2891,"children":2892},{"style":104},[2893],{"type":59,"value":241},{"type":53,"tag":81,"props":2895,"children":2896},{"class":83,"line":244},[2897,2902,2906,2910,2914,2918],{"type":53,"tag":81,"props":2898,"children":2899},{"style":248},[2900],{"type":59,"value":2901},"    code",{"type":53,"tag":81,"props":2903,"children":2904},{"style":104},[2905],{"type":59,"value":328},{"type":53,"tag":81,"props":2907,"children":2908},{"style":104},[2909],{"type":59,"value":128},{"type":53,"tag":81,"props":2911,"children":2912},{"style":131},[2913],{"type":59,"value":1059},{"type":53,"tag":81,"props":2915,"children":2916},{"style":104},[2917],{"type":59,"value":139},{"type":53,"tag":81,"props":2919,"children":2920},{"style":104},[2921],{"type":59,"value":314},{"type":53,"tag":81,"props":2923,"children":2924},{"class":83,"line":285},[2925,2930,2934,2938,2943,2947],{"type":53,"tag":81,"props":2926,"children":2927},{"style":248},[2928],{"type":59,"value":2929},"    message",{"type":53,"tag":81,"props":2931,"children":2932},{"style":104},[2933],{"type":59,"value":328},{"type":53,"tag":81,"props":2935,"children":2936},{"style":104},[2937],{"type":59,"value":128},{"type":53,"tag":81,"props":2939,"children":2940},{"style":131},[2941],{"type":59,"value":2942},"User not found",{"type":53,"tag":81,"props":2944,"children":2945},{"style":104},[2946],{"type":59,"value":139},{"type":53,"tag":81,"props":2948,"children":2949},{"style":104},[2950],{"type":59,"value":314},{"type":53,"tag":81,"props":2952,"children":2953},{"class":83,"line":298},[2954,2958,2962],{"type":53,"tag":81,"props":2955,"children":2956},{"style":104},[2957],{"type":59,"value":1745},{"type":53,"tag":81,"props":2959,"children":2960},{"style":248},[2961],{"type":59,"value":526},{"type":53,"tag":81,"props":2963,"children":2964},{"style":104},[2965],{"type":59,"value":144},{"type":53,"tag":81,"props":2967,"children":2968},{"class":83,"line":317},[2969],{"type":53,"tag":81,"props":2970,"children":2971},{"style":88},[2972],{"type":59,"value":2973},"  \u002F\u002F client receives 404 NOT_FOUND\n",{"type":53,"tag":81,"props":2975,"children":2976},{"class":83,"line":335},[2977,2981,2985],{"type":53,"tag":81,"props":2978,"children":2979},{"style":104},[2980],{"type":59,"value":521},{"type":53,"tag":81,"props":2982,"children":2983},{"style":110},[2984],{"type":59,"value":526},{"type":53,"tag":81,"props":2986,"children":2987},{"style":104},[2988],{"type":59,"value":144},{"type":53,"tag":1850,"props":2990,"children":2991},{},[2992],{"type":59,"value":2993},"Plain Error objects are caught and wrapped as INTERNAL_SERVER_ERROR (500); use TRPCError with a specific code for proper HTTP status mapping.",{"type":53,"tag":1850,"props":2995,"children":2996},{},[2997],{"type":59,"value":2998},"Source: www\u002Fdocs\u002Fserver\u002Ferror-handling.md",{"type":53,"tag":625,"props":3000,"children":3002},{"id":3001},"medium-expecting-stack-traces-in-production",[3003,3008],{"type":53,"tag":81,"props":3004,"children":3005},{},[3006],{"type":59,"value":3007},"MEDIUM",{"type":59,"value":3009}," Expecting stack traces in production",{"type":53,"tag":1850,"props":3011,"children":3012},{},[3013],{"type":59,"value":2570},{"type":53,"tag":69,"props":3015,"children":3017},{"className":71,"code":3016,"language":73,"meta":74,"style":74},"import { initTRPC } from '@trpc\u002Fserver';\n\n\u002F\u002F No explicit isDev setting\nconst t = initTRPC.create();\n\u002F\u002F Stack traces may or may not appear depending on NODE_ENV\n",[3018],{"type":53,"tag":77,"props":3019,"children":3020},{"__ignoreMap":74},[3021,3060,3067,3075,3110],{"type":53,"tag":81,"props":3022,"children":3023},{"class":83,"line":84},[3024,3028,3032,3036,3040,3044,3048,3052,3056],{"type":53,"tag":81,"props":3025,"children":3026},{"style":98},[3027],{"type":59,"value":101},{"type":53,"tag":81,"props":3029,"children":3030},{"style":104},[3031],{"type":59,"value":107},{"type":53,"tag":81,"props":3033,"children":3034},{"style":110},[3035],{"type":59,"value":113},{"type":53,"tag":81,"props":3037,"children":3038},{"style":104},[3039],{"type":59,"value":118},{"type":53,"tag":81,"props":3041,"children":3042},{"style":98},[3043],{"type":59,"value":123},{"type":53,"tag":81,"props":3045,"children":3046},{"style":104},[3047],{"type":59,"value":128},{"type":53,"tag":81,"props":3049,"children":3050},{"style":131},[3051],{"type":59,"value":134},{"type":53,"tag":81,"props":3053,"children":3054},{"style":104},[3055],{"type":59,"value":139},{"type":53,"tag":81,"props":3057,"children":3058},{"style":104},[3059],{"type":59,"value":144},{"type":53,"tag":81,"props":3061,"children":3062},{"class":83,"line":94},[3063],{"type":53,"tag":81,"props":3064,"children":3065},{"emptyLinePlaceholder":193},[3066],{"type":59,"value":196},{"type":53,"tag":81,"props":3068,"children":3069},{"class":83,"line":147},[3070],{"type":53,"tag":81,"props":3071,"children":3072},{"style":88},[3073],{"type":59,"value":3074},"\u002F\u002F No explicit isDev setting\n",{"type":53,"tag":81,"props":3076,"children":3077},{"class":83,"line":189},[3078,3082,3086,3090,3094,3098,3102,3106],{"type":53,"tag":81,"props":3079,"children":3080},{"style":203},[3081],{"type":59,"value":206},{"type":53,"tag":81,"props":3083,"children":3084},{"style":110},[3085],{"type":59,"value":211},{"type":53,"tag":81,"props":3087,"children":3088},{"style":104},[3089],{"type":59,"value":216},{"type":53,"tag":81,"props":3091,"children":3092},{"style":110},[3093],{"type":59,"value":113},{"type":53,"tag":81,"props":3095,"children":3096},{"style":104},[3097],{"type":59,"value":225},{"type":53,"tag":81,"props":3099,"children":3100},{"style":228},[3101],{"type":59,"value":231},{"type":53,"tag":81,"props":3103,"children":3104},{"style":110},[3105],{"type":59,"value":1577},{"type":53,"tag":81,"props":3107,"children":3108},{"style":104},[3109],{"type":59,"value":144},{"type":53,"tag":81,"props":3111,"children":3112},{"class":83,"line":199},[3113],{"type":53,"tag":81,"props":3114,"children":3115},{"style":88},[3116],{"type":59,"value":3117},"\u002F\u002F Stack traces may or may not appear depending on NODE_ENV\n",{"type":53,"tag":1850,"props":3119,"children":3120},{},[3121],{"type":59,"value":2735},{"type":53,"tag":69,"props":3123,"children":3125},{"className":71,"code":3124,"language":73,"meta":74,"style":74},"import { initTRPC } from '@trpc\u002Fserver';\n\nconst t = initTRPC.create({\n  isDev: process.env.NODE_ENV === 'development',\n});\n",[3126],{"type":53,"tag":77,"props":3127,"children":3128},{"__ignoreMap":74},[3129,3168,3175,3210,3267],{"type":53,"tag":81,"props":3130,"children":3131},{"class":83,"line":84},[3132,3136,3140,3144,3148,3152,3156,3160,3164],{"type":53,"tag":81,"props":3133,"children":3134},{"style":98},[3135],{"type":59,"value":101},{"type":53,"tag":81,"props":3137,"children":3138},{"style":104},[3139],{"type":59,"value":107},{"type":53,"tag":81,"props":3141,"children":3142},{"style":110},[3143],{"type":59,"value":113},{"type":53,"tag":81,"props":3145,"children":3146},{"style":104},[3147],{"type":59,"value":118},{"type":53,"tag":81,"props":3149,"children":3150},{"style":98},[3151],{"type":59,"value":123},{"type":53,"tag":81,"props":3153,"children":3154},{"style":104},[3155],{"type":59,"value":128},{"type":53,"tag":81,"props":3157,"children":3158},{"style":131},[3159],{"type":59,"value":134},{"type":53,"tag":81,"props":3161,"children":3162},{"style":104},[3163],{"type":59,"value":139},{"type":53,"tag":81,"props":3165,"children":3166},{"style":104},[3167],{"type":59,"value":144},{"type":53,"tag":81,"props":3169,"children":3170},{"class":83,"line":94},[3171],{"type":53,"tag":81,"props":3172,"children":3173},{"emptyLinePlaceholder":193},[3174],{"type":59,"value":196},{"type":53,"tag":81,"props":3176,"children":3177},{"class":83,"line":147},[3178,3182,3186,3190,3194,3198,3202,3206],{"type":53,"tag":81,"props":3179,"children":3180},{"style":203},[3181],{"type":59,"value":206},{"type":53,"tag":81,"props":3183,"children":3184},{"style":110},[3185],{"type":59,"value":211},{"type":53,"tag":81,"props":3187,"children":3188},{"style":104},[3189],{"type":59,"value":216},{"type":53,"tag":81,"props":3191,"children":3192},{"style":110},[3193],{"type":59,"value":113},{"type":53,"tag":81,"props":3195,"children":3196},{"style":104},[3197],{"type":59,"value":225},{"type":53,"tag":81,"props":3199,"children":3200},{"style":228},[3201],{"type":59,"value":231},{"type":53,"tag":81,"props":3203,"children":3204},{"style":110},[3205],{"type":59,"value":236},{"type":53,"tag":81,"props":3207,"children":3208},{"style":104},[3209],{"type":59,"value":241},{"type":53,"tag":81,"props":3211,"children":3212},{"class":83,"line":189},[3213,3218,3222,3227,3231,3236,3240,3245,3250,3254,3259,3263],{"type":53,"tag":81,"props":3214,"children":3215},{"style":248},[3216],{"type":59,"value":3217},"  isDev",{"type":53,"tag":81,"props":3219,"children":3220},{"style":104},[3221],{"type":59,"value":328},{"type":53,"tag":81,"props":3223,"children":3224},{"style":110},[3225],{"type":59,"value":3226}," process",{"type":53,"tag":81,"props":3228,"children":3229},{"style":104},[3230],{"type":59,"value":225},{"type":53,"tag":81,"props":3232,"children":3233},{"style":110},[3234],{"type":59,"value":3235},"env",{"type":53,"tag":81,"props":3237,"children":3238},{"style":104},[3239],{"type":59,"value":225},{"type":53,"tag":81,"props":3241,"children":3242},{"style":110},[3243],{"type":59,"value":3244},"NODE_ENV ",{"type":53,"tag":81,"props":3246,"children":3247},{"style":104},[3248],{"type":59,"value":3249},"===",{"type":53,"tag":81,"props":3251,"children":3252},{"style":104},[3253],{"type":59,"value":128},{"type":53,"tag":81,"props":3255,"children":3256},{"style":131},[3257],{"type":59,"value":3258},"development",{"type":53,"tag":81,"props":3260,"children":3261},{"style":104},[3262],{"type":59,"value":139},{"type":53,"tag":81,"props":3264,"children":3265},{"style":104},[3266],{"type":59,"value":314},{"type":53,"tag":81,"props":3268,"children":3269},{"class":83,"line":199},[3270,3274,3278],{"type":53,"tag":81,"props":3271,"children":3272},{"style":104},[3273],{"type":59,"value":521},{"type":53,"tag":81,"props":3275,"children":3276},{"style":110},[3277],{"type":59,"value":526},{"type":53,"tag":81,"props":3279,"children":3280},{"style":104},[3281],{"type":59,"value":144},{"type":53,"tag":1850,"props":3283,"children":3284},{},[3285,3287,3293,3295,3301,3303,3308],{"type":59,"value":3286},"Stack traces are included only when ",{"type":53,"tag":77,"props":3288,"children":3290},{"className":3289},[],[3291],{"type":59,"value":3292},"isDev",{"type":59,"value":3294}," is true (default: ",{"type":53,"tag":77,"props":3296,"children":3298},{"className":3297},[],[3299],{"type":59,"value":3300},"NODE_ENV !== \"production\"",{"type":59,"value":3302},"); set ",{"type":53,"tag":77,"props":3304,"children":3306},{"className":3305},[],[3307],{"type":59,"value":3292},{"type":59,"value":3309}," explicitly for deterministic behavior across runtimes.",{"type":53,"tag":1850,"props":3311,"children":3312},{},[3313],{"type":59,"value":2998},{"type":53,"tag":625,"props":3315,"children":3317},{"id":3316},"high-not-handling-zod-errors-in-errorformatter",[3318,3322],{"type":53,"tag":81,"props":3319,"children":3320},{},[3321],{"type":59,"value":2563},{"type":59,"value":3323}," Not handling Zod errors in errorFormatter",{"type":53,"tag":1850,"props":3325,"children":3326},{},[3327],{"type":59,"value":2570},{"type":53,"tag":69,"props":3329,"children":3331},{"className":71,"code":3330,"language":73,"meta":74,"style":74},"import { initTRPC } from '@trpc\u002Fserver';\n\n\u002F\u002F No errorFormatter -- client gets generic \"Input validation failed\"\nconst t = initTRPC.create();\n",[3332],{"type":53,"tag":77,"props":3333,"children":3334},{"__ignoreMap":74},[3335,3374,3381,3389],{"type":53,"tag":81,"props":3336,"children":3337},{"class":83,"line":84},[3338,3342,3346,3350,3354,3358,3362,3366,3370],{"type":53,"tag":81,"props":3339,"children":3340},{"style":98},[3341],{"type":59,"value":101},{"type":53,"tag":81,"props":3343,"children":3344},{"style":104},[3345],{"type":59,"value":107},{"type":53,"tag":81,"props":3347,"children":3348},{"style":110},[3349],{"type":59,"value":113},{"type":53,"tag":81,"props":3351,"children":3352},{"style":104},[3353],{"type":59,"value":118},{"type":53,"tag":81,"props":3355,"children":3356},{"style":98},[3357],{"type":59,"value":123},{"type":53,"tag":81,"props":3359,"children":3360},{"style":104},[3361],{"type":59,"value":128},{"type":53,"tag":81,"props":3363,"children":3364},{"style":131},[3365],{"type":59,"value":134},{"type":53,"tag":81,"props":3367,"children":3368},{"style":104},[3369],{"type":59,"value":139},{"type":53,"tag":81,"props":3371,"children":3372},{"style":104},[3373],{"type":59,"value":144},{"type":53,"tag":81,"props":3375,"children":3376},{"class":83,"line":94},[3377],{"type":53,"tag":81,"props":3378,"children":3379},{"emptyLinePlaceholder":193},[3380],{"type":59,"value":196},{"type":53,"tag":81,"props":3382,"children":3383},{"class":83,"line":147},[3384],{"type":53,"tag":81,"props":3385,"children":3386},{"style":88},[3387],{"type":59,"value":3388},"\u002F\u002F No errorFormatter -- client gets generic \"Input validation failed\"\n",{"type":53,"tag":81,"props":3390,"children":3391},{"class":83,"line":189},[3392,3396,3400,3404,3408,3412,3416,3420],{"type":53,"tag":81,"props":3393,"children":3394},{"style":203},[3395],{"type":59,"value":206},{"type":53,"tag":81,"props":3397,"children":3398},{"style":110},[3399],{"type":59,"value":211},{"type":53,"tag":81,"props":3401,"children":3402},{"style":104},[3403],{"type":59,"value":216},{"type":53,"tag":81,"props":3405,"children":3406},{"style":110},[3407],{"type":59,"value":113},{"type":53,"tag":81,"props":3409,"children":3410},{"style":104},[3411],{"type":59,"value":225},{"type":53,"tag":81,"props":3413,"children":3414},{"style":228},[3415],{"type":59,"value":231},{"type":53,"tag":81,"props":3417,"children":3418},{"style":110},[3419],{"type":59,"value":1577},{"type":53,"tag":81,"props":3421,"children":3422},{"style":104},[3423],{"type":59,"value":144},{"type":53,"tag":1850,"props":3425,"children":3426},{},[3427],{"type":59,"value":2735},{"type":53,"tag":69,"props":3429,"children":3431},{"className":71,"code":3430,"language":73,"meta":74,"style":74},"import { initTRPC } from '@trpc\u002Fserver';\nimport { ZodError } from 'zod';\n\nconst t = initTRPC.create({\n  errorFormatter({ shape, error }) {\n    return {\n      ...shape,\n      data: {\n        ...shape.data,\n        zodError:\n          error.code === 'BAD_REQUEST' && error.cause instanceof ZodError\n            ? error.cause.flatten()\n            : null,\n      },\n    };\n  },\n});\n",[3432],{"type":53,"tag":77,"props":3433,"children":3434},{"__ignoreMap":74},[3435,3474,3513,3520,3555,3586,3597,3612,3627,3650,3661,3716,3747,3758,3765,3772,3779],{"type":53,"tag":81,"props":3436,"children":3437},{"class":83,"line":84},[3438,3442,3446,3450,3454,3458,3462,3466,3470],{"type":53,"tag":81,"props":3439,"children":3440},{"style":98},[3441],{"type":59,"value":101},{"type":53,"tag":81,"props":3443,"children":3444},{"style":104},[3445],{"type":59,"value":107},{"type":53,"tag":81,"props":3447,"children":3448},{"style":110},[3449],{"type":59,"value":113},{"type":53,"tag":81,"props":3451,"children":3452},{"style":104},[3453],{"type":59,"value":118},{"type":53,"tag":81,"props":3455,"children":3456},{"style":98},[3457],{"type":59,"value":123},{"type":53,"tag":81,"props":3459,"children":3460},{"style":104},[3461],{"type":59,"value":128},{"type":53,"tag":81,"props":3463,"children":3464},{"style":131},[3465],{"type":59,"value":134},{"type":53,"tag":81,"props":3467,"children":3468},{"style":104},[3469],{"type":59,"value":139},{"type":53,"tag":81,"props":3471,"children":3472},{"style":104},[3473],{"type":59,"value":144},{"type":53,"tag":81,"props":3475,"children":3476},{"class":83,"line":94},[3477,3481,3485,3489,3493,3497,3501,3505,3509],{"type":53,"tag":81,"props":3478,"children":3479},{"style":98},[3480],{"type":59,"value":101},{"type":53,"tag":81,"props":3482,"children":3483},{"style":104},[3484],{"type":59,"value":107},{"type":53,"tag":81,"props":3486,"children":3487},{"style":110},[3488],{"type":59,"value":161},{"type":53,"tag":81,"props":3490,"children":3491},{"style":104},[3492],{"type":59,"value":118},{"type":53,"tag":81,"props":3494,"children":3495},{"style":98},[3496],{"type":59,"value":123},{"type":53,"tag":81,"props":3498,"children":3499},{"style":104},[3500],{"type":59,"value":128},{"type":53,"tag":81,"props":3502,"children":3503},{"style":131},[3504],{"type":59,"value":178},{"type":53,"tag":81,"props":3506,"children":3507},{"style":104},[3508],{"type":59,"value":139},{"type":53,"tag":81,"props":3510,"children":3511},{"style":104},[3512],{"type":59,"value":144},{"type":53,"tag":81,"props":3514,"children":3515},{"class":83,"line":147},[3516],{"type":53,"tag":81,"props":3517,"children":3518},{"emptyLinePlaceholder":193},[3519],{"type":59,"value":196},{"type":53,"tag":81,"props":3521,"children":3522},{"class":83,"line":189},[3523,3527,3531,3535,3539,3543,3547,3551],{"type":53,"tag":81,"props":3524,"children":3525},{"style":203},[3526],{"type":59,"value":206},{"type":53,"tag":81,"props":3528,"children":3529},{"style":110},[3530],{"type":59,"value":211},{"type":53,"tag":81,"props":3532,"children":3533},{"style":104},[3534],{"type":59,"value":216},{"type":53,"tag":81,"props":3536,"children":3537},{"style":110},[3538],{"type":59,"value":113},{"type":53,"tag":81,"props":3540,"children":3541},{"style":104},[3542],{"type":59,"value":225},{"type":53,"tag":81,"props":3544,"children":3545},{"style":228},[3546],{"type":59,"value":231},{"type":53,"tag":81,"props":3548,"children":3549},{"style":110},[3550],{"type":59,"value":236},{"type":53,"tag":81,"props":3552,"children":3553},{"style":104},[3554],{"type":59,"value":241},{"type":53,"tag":81,"props":3556,"children":3557},{"class":83,"line":199},[3558,3562,3566,3570,3574,3578,3582],{"type":53,"tag":81,"props":3559,"children":3560},{"style":248},[3561],{"type":59,"value":251},{"type":53,"tag":81,"props":3563,"children":3564},{"style":104},[3565],{"type":59,"value":256},{"type":53,"tag":81,"props":3567,"children":3568},{"style":259},[3569],{"type":59,"value":262},{"type":53,"tag":81,"props":3571,"children":3572},{"style":104},[3573],{"type":59,"value":267},{"type":53,"tag":81,"props":3575,"children":3576},{"style":259},[3577],{"type":59,"value":272},{"type":53,"tag":81,"props":3579,"children":3580},{"style":104},[3581],{"type":59,"value":277},{"type":53,"tag":81,"props":3583,"children":3584},{"style":104},[3585],{"type":59,"value":282},{"type":53,"tag":81,"props":3587,"children":3588},{"class":83,"line":244},[3589,3593],{"type":53,"tag":81,"props":3590,"children":3591},{"style":98},[3592],{"type":59,"value":291},{"type":53,"tag":81,"props":3594,"children":3595},{"style":104},[3596],{"type":59,"value":282},{"type":53,"tag":81,"props":3598,"children":3599},{"class":83,"line":285},[3600,3604,3608],{"type":53,"tag":81,"props":3601,"children":3602},{"style":104},[3603],{"type":59,"value":304},{"type":53,"tag":81,"props":3605,"children":3606},{"style":110},[3607],{"type":59,"value":309},{"type":53,"tag":81,"props":3609,"children":3610},{"style":104},[3611],{"type":59,"value":314},{"type":53,"tag":81,"props":3613,"children":3614},{"class":83,"line":298},[3615,3619,3623],{"type":53,"tag":81,"props":3616,"children":3617},{"style":248},[3618],{"type":59,"value":323},{"type":53,"tag":81,"props":3620,"children":3621},{"style":104},[3622],{"type":59,"value":328},{"type":53,"tag":81,"props":3624,"children":3625},{"style":104},[3626],{"type":59,"value":282},{"type":53,"tag":81,"props":3628,"children":3629},{"class":83,"line":317},[3630,3634,3638,3642,3646],{"type":53,"tag":81,"props":3631,"children":3632},{"style":104},[3633],{"type":59,"value":341},{"type":53,"tag":81,"props":3635,"children":3636},{"style":110},[3637],{"type":59,"value":309},{"type":53,"tag":81,"props":3639,"children":3640},{"style":104},[3641],{"type":59,"value":225},{"type":53,"tag":81,"props":3643,"children":3644},{"style":110},[3645],{"type":59,"value":354},{"type":53,"tag":81,"props":3647,"children":3648},{"style":104},[3649],{"type":59,"value":314},{"type":53,"tag":81,"props":3651,"children":3652},{"class":83,"line":335},[3653,3657],{"type":53,"tag":81,"props":3654,"children":3655},{"style":248},[3656],{"type":59,"value":367},{"type":53,"tag":81,"props":3658,"children":3659},{"style":104},[3660],{"type":59,"value":372},{"type":53,"tag":81,"props":3662,"children":3663},{"class":83,"line":361},[3664,3668,3672,3676,3680,3684,3688,3692,3696,3700,3704,3708,3712],{"type":53,"tag":81,"props":3665,"children":3666},{"style":110},[3667],{"type":59,"value":381},{"type":53,"tag":81,"props":3669,"children":3670},{"style":104},[3671],{"type":59,"value":225},{"type":53,"tag":81,"props":3673,"children":3674},{"style":110},[3675],{"type":59,"value":77},{"type":53,"tag":81,"props":3677,"children":3678},{"style":104},[3679],{"type":59,"value":394},{"type":53,"tag":81,"props":3681,"children":3682},{"style":104},[3683],{"type":59,"value":128},{"type":53,"tag":81,"props":3685,"children":3686},{"style":131},[3687],{"type":59,"value":403},{"type":53,"tag":81,"props":3689,"children":3690},{"style":104},[3691],{"type":59,"value":139},{"type":53,"tag":81,"props":3693,"children":3694},{"style":104},[3695],{"type":59,"value":412},{"type":53,"tag":81,"props":3697,"children":3698},{"style":110},[3699],{"type":59,"value":272},{"type":53,"tag":81,"props":3701,"children":3702},{"style":104},[3703],{"type":59,"value":225},{"type":53,"tag":81,"props":3705,"children":3706},{"style":110},[3707],{"type":59,"value":425},{"type":53,"tag":81,"props":3709,"children":3710},{"style":104},[3711],{"type":59,"value":430},{"type":53,"tag":81,"props":3713,"children":3714},{"style":433},[3715],{"type":59,"value":436},{"type":53,"tag":81,"props":3717,"children":3718},{"class":83,"line":375},[3719,3723,3727,3731,3735,3739,3743],{"type":53,"tag":81,"props":3720,"children":3721},{"style":104},[3722],{"type":59,"value":445},{"type":53,"tag":81,"props":3724,"children":3725},{"style":110},[3726],{"type":59,"value":272},{"type":53,"tag":81,"props":3728,"children":3729},{"style":104},[3730],{"type":59,"value":225},{"type":53,"tag":81,"props":3732,"children":3733},{"style":110},[3734],{"type":59,"value":425},{"type":53,"tag":81,"props":3736,"children":3737},{"style":104},[3738],{"type":59,"value":225},{"type":53,"tag":81,"props":3740,"children":3741},{"style":228},[3742],{"type":59,"value":466},{"type":53,"tag":81,"props":3744,"children":3745},{"style":248},[3746],{"type":59,"value":471},{"type":53,"tag":81,"props":3748,"children":3749},{"class":83,"line":439},[3750,3754],{"type":53,"tag":81,"props":3751,"children":3752},{"style":104},[3753],{"type":59,"value":480},{"type":53,"tag":81,"props":3755,"children":3756},{"style":104},[3757],{"type":59,"value":485},{"type":53,"tag":81,"props":3759,"children":3760},{"class":83,"line":474},[3761],{"type":53,"tag":81,"props":3762,"children":3763},{"style":104},[3764],{"type":59,"value":494},{"type":53,"tag":81,"props":3766,"children":3767},{"class":83,"line":488},[3768],{"type":53,"tag":81,"props":3769,"children":3770},{"style":104},[3771],{"type":59,"value":503},{"type":53,"tag":81,"props":3773,"children":3774},{"class":83,"line":497},[3775],{"type":53,"tag":81,"props":3776,"children":3777},{"style":104},[3778],{"type":59,"value":512},{"type":53,"tag":81,"props":3780,"children":3781},{"class":83,"line":506},[3782,3786,3790],{"type":53,"tag":81,"props":3783,"children":3784},{"style":104},[3785],{"type":59,"value":521},{"type":53,"tag":81,"props":3787,"children":3788},{"style":110},[3789],{"type":59,"value":526},{"type":53,"tag":81,"props":3791,"children":3792},{"style":104},[3793],{"type":59,"value":144},{"type":53,"tag":1850,"props":3795,"children":3796},{},[3797],{"type":59,"value":3798},"Without a custom errorFormatter, the client receives a generic message without field-level validation details from Zod.",{"type":53,"tag":1850,"props":3800,"children":3801},{},[3802],{"type":59,"value":3803},"Source: www\u002Fdocs\u002Fserver\u002Ferror-formatting.md",{"type":53,"tag":62,"props":3805,"children":3807},{"id":3806},"error-code-reference",[3808],{"type":59,"value":3809},"Error Code Reference",{"type":53,"tag":3811,"props":3812,"children":3813},"table",{},[3814,3838],{"type":53,"tag":3815,"props":3816,"children":3817},"thead",{},[3818],{"type":53,"tag":3819,"props":3820,"children":3821},"tr",{},[3822,3828,3833],{"type":53,"tag":3823,"props":3824,"children":3825},"th",{},[3826],{"type":59,"value":3827},"Code",{"type":53,"tag":3823,"props":3829,"children":3830},{},[3831],{"type":59,"value":3832},"HTTP",{"type":53,"tag":3823,"props":3834,"children":3835},{},[3836],{"type":59,"value":3837},"Use when",{"type":53,"tag":3839,"props":3840,"children":3841},"tbody",{},[3842,3860,3878,3896,3913,3931,3949,3967],{"type":53,"tag":3819,"props":3843,"children":3844},{},[3845,3850,3855],{"type":53,"tag":3846,"props":3847,"children":3848},"td",{},[3849],{"type":59,"value":403},{"type":53,"tag":3846,"props":3851,"children":3852},{},[3853],{"type":59,"value":3854},"400",{"type":53,"tag":3846,"props":3856,"children":3857},{},[3858],{"type":59,"value":3859},"Invalid input",{"type":53,"tag":3819,"props":3861,"children":3862},{},[3863,3868,3873],{"type":53,"tag":3846,"props":3864,"children":3865},{},[3866],{"type":59,"value":3867},"UNAUTHORIZED",{"type":53,"tag":3846,"props":3869,"children":3870},{},[3871],{"type":59,"value":3872},"401",{"type":53,"tag":3846,"props":3874,"children":3875},{},[3876],{"type":59,"value":3877},"Missing or invalid auth credentials",{"type":53,"tag":3819,"props":3879,"children":3880},{},[3881,3886,3891],{"type":53,"tag":3846,"props":3882,"children":3883},{},[3884],{"type":59,"value":3885},"FORBIDDEN",{"type":53,"tag":3846,"props":3887,"children":3888},{},[3889],{"type":59,"value":3890},"403",{"type":53,"tag":3846,"props":3892,"children":3893},{},[3894],{"type":59,"value":3895},"Authenticated but not authorized",{"type":53,"tag":3819,"props":3897,"children":3898},{},[3899,3903,3908],{"type":53,"tag":3846,"props":3900,"children":3901},{},[3902],{"type":59,"value":1059},{"type":53,"tag":3846,"props":3904,"children":3905},{},[3906],{"type":59,"value":3907},"404",{"type":53,"tag":3846,"props":3909,"children":3910},{},[3911],{"type":59,"value":3912},"Resource does not exist",{"type":53,"tag":3819,"props":3914,"children":3915},{},[3916,3921,3926],{"type":53,"tag":3846,"props":3917,"children":3918},{},[3919],{"type":59,"value":3920},"CONFLICT",{"type":53,"tag":3846,"props":3922,"children":3923},{},[3924],{"type":59,"value":3925},"409",{"type":53,"tag":3846,"props":3927,"children":3928},{},[3929],{"type":59,"value":3930},"Request conflicts with current state",{"type":53,"tag":3819,"props":3932,"children":3933},{},[3934,3939,3944],{"type":53,"tag":3846,"props":3935,"children":3936},{},[3937],{"type":59,"value":3938},"UNPROCESSABLE_CONTENT",{"type":53,"tag":3846,"props":3940,"children":3941},{},[3942],{"type":59,"value":3943},"422",{"type":53,"tag":3846,"props":3945,"children":3946},{},[3947],{"type":59,"value":3948},"Valid syntax but semantic error",{"type":53,"tag":3819,"props":3950,"children":3951},{},[3952,3957,3962],{"type":53,"tag":3846,"props":3953,"children":3954},{},[3955],{"type":59,"value":3956},"TOO_MANY_REQUESTS",{"type":53,"tag":3846,"props":3958,"children":3959},{},[3960],{"type":59,"value":3961},"429",{"type":53,"tag":3846,"props":3963,"children":3964},{},[3965],{"type":59,"value":3966},"Rate limit exceeded",{"type":53,"tag":3819,"props":3968,"children":3969},{},[3970,3974,3979],{"type":53,"tag":3846,"props":3971,"children":3972},{},[3973],{"type":59,"value":1655},{"type":53,"tag":3846,"props":3975,"children":3976},{},[3977],{"type":59,"value":3978},"500",{"type":53,"tag":3846,"props":3980,"children":3981},{},[3982],{"type":59,"value":3983},"Unexpected server error",{"type":53,"tag":62,"props":3985,"children":3987},{"id":3986},"see-also",[3988],{"type":59,"value":3989},"See Also",{"type":53,"tag":3991,"props":3992,"children":3993},"ul",{},[3994,4005,4016,4027],{"type":53,"tag":3995,"props":3996,"children":3997},"li",{},[3998,4003],{"type":53,"tag":77,"props":3999,"children":4001},{"className":4000},[],[4002],{"type":59,"value":44},{"type":59,"value":4004}," -- initTRPC configuration including isDev",{"type":53,"tag":3995,"props":4006,"children":4007},{},[4008,4014],{"type":53,"tag":77,"props":4009,"children":4011},{"className":4010},[],[4012],{"type":59,"value":4013},"validators",{"type":59,"value":4015}," -- input validation that triggers BAD_REQUEST errors",{"type":53,"tag":3995,"props":4017,"children":4018},{},[4019,4025],{"type":53,"tag":77,"props":4020,"children":4022},{"className":4021},[],[4023],{"type":59,"value":4024},"middlewares",{"type":59,"value":4026}," -- auth middleware throwing UNAUTHORIZED",{"type":53,"tag":3995,"props":4028,"children":4029},{},[4030,4036],{"type":53,"tag":77,"props":4031,"children":4033},{"className":4032},[],[4034],{"type":59,"value":4035},"server-side-calls",{"type":59,"value":4037}," -- catching TRPCError in server-side callers",{"type":53,"tag":4039,"props":4040,"children":4041},"style",{},[4042],{"type":59,"value":4043},"html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"items":4045,"total":4148},[4046,4061,4074,4087,4107,4120,4134],{"slug":4047,"name":4047,"fn":4048,"description":4049,"org":4050,"tags":4051,"stars":23,"repoUrl":24,"updatedAt":4060},"adapter-aws-lambda","deploy tRPC APIs on AWS Lambda","Deploy tRPC on AWS Lambda with awsLambdaRequestHandler() from @trpc\u002Fserver\u002Fadapters\u002Faws-lambda for API Gateway v1 (REST, APIGatewayProxyEvent) and v2 (HTTP, APIGatewayProxyEventV2), and Lambda Function URLs. Enable response streaming with awsLambdaStreamingRequestHandler() wrapped in awslambda.streamifyResponse(). CreateAWSLambdaContextOptions provides event and context for context creation.\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[4052,4055,4058,4059],{"name":4053,"slug":4054,"type":15},"API Development","api-development",{"name":4056,"slug":4057,"type":15},"AWS","aws",{"name":13,"slug":14,"type":15},{"name":9,"slug":8,"type":15},"2026-07-18T05:47:05.451869",{"slug":4062,"name":4062,"fn":4063,"description":4064,"org":4065,"tags":4066,"stars":23,"repoUrl":24,"updatedAt":4073},"adapter-express","mount tRPC as Express middleware","Mount tRPC as Express middleware with createExpressMiddleware() from @trpc\u002Fserver\u002Fadapters\u002Fexpress. Access Express req\u002Fres in createContext via CreateExpressContextOptions. Mount at a path prefix like app.use('\u002Ftrpc', ...). Avoid global express.json() conflicting with tRPC body parsing for FormData.\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[4067,4068,4069,4072],{"name":4053,"slug":4054,"type":15},{"name":13,"slug":14,"type":15},{"name":4070,"slug":4071,"type":15},"Express","express",{"name":9,"slug":8,"type":15},"2026-07-18T05:46:53.274248",{"slug":4075,"name":4075,"fn":4076,"description":4077,"org":4078,"tags":4079,"stars":23,"repoUrl":24,"updatedAt":4086},"adapter-fastify","mount tRPC as a Fastify plugin","Mount tRPC as a Fastify plugin with fastifyTRPCPlugin from @trpc\u002Fserver\u002Fadapters\u002Ffastify. Configure prefix, trpcOptions (router, createContext, onError). Enable WebSocket subscriptions with useWSS and @fastify\u002Fwebsocket. Set routerOptions.maxParamLength for batch requests. Requires Fastify v5+. FastifyTRPCPluginOptions for type-safe onError. CreateFastifyContextOptions provides req, res.\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[4080,4081,4082,4085],{"name":4053,"slug":4054,"type":15},{"name":13,"slug":14,"type":15},{"name":4083,"slug":4084,"type":15},"Fastify","fastify",{"name":9,"slug":8,"type":15},"2026-07-18T05:46:53.746621",{"slug":4088,"name":4088,"fn":4089,"description":4090,"org":4091,"tags":4092,"stars":23,"repoUrl":24,"updatedAt":4106},"adapter-fetch","deploy tRPC on edge runtimes","Deploy tRPC on WinterCG-compliant edge runtimes with fetchRequestHandler() from @trpc\u002Fserver\u002Fadapters\u002Ffetch. Supports Cloudflare Workers, Deno Deploy, Vercel Edge Runtime, Astro, Remix, SolidStart. FetchCreateContextFnOptions provides req (Request) and resHeaders (Headers) for context creation. The endpoint option must match the URL path prefix where the handler is mounted.\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[4093,4096,4099,4102,4103],{"name":4094,"slug":4095,"type":15},"Cloudflare","cloudflare",{"name":4097,"slug":4098,"type":15},"Deployment","deployment",{"name":4100,"slug":4101,"type":15},"Edge","edge",{"name":9,"slug":8,"type":15},{"name":4104,"slug":4105,"type":15},"Vercel","vercel","2026-07-18T05:46:50.548228",{"slug":4108,"name":4108,"fn":4109,"description":4110,"org":4111,"tags":4112,"stars":23,"repoUrl":24,"updatedAt":4119},"adapter-standalone","mount tRPC on Node.js servers","Mount tRPC on Node.js built-in HTTP server with createHTTPServer() from @trpc\u002Fserver\u002Fadapters\u002Fstandalone, createHTTPHandler() for custom http.createServer, createHTTP2Handler() for HTTP\u002F2 with TLS. Configure basePath to slice URL prefix, CORS via the cors npm package passed as middleware option. CreateHTTPContextOptions provides req and res for context creation.\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[4113,4114,4115,4118],{"name":4053,"slug":4054,"type":15},{"name":13,"slug":14,"type":15},{"name":4116,"slug":4117,"type":15},"Node.js","node-js",{"name":9,"slug":8,"type":15},"2026-07-18T05:46:58.093869",{"slug":4121,"name":4121,"fn":4122,"description":4123,"org":4124,"tags":4125,"stars":23,"repoUrl":24,"updatedAt":4133},"auth","implement authentication in tRPC applications","Implement JWT\u002Fcookie authentication and authorization in tRPC using createContext for user extraction, t.middleware with opts.next({ ctx }) for context narrowing to non-null user, protectedProcedure base pattern, client-side Authorization headers via httpBatchLink headers(), WebSocket connectionParams, and SSE auth via cookies or EventSource polyfill custom headers.\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[4126,4128,4131,4132],{"name":4127,"slug":4121,"type":15},"Auth",{"name":4129,"slug":4130,"type":15},"Authentication","authentication",{"name":13,"slug":14,"type":15},{"name":9,"slug":8,"type":15},"2026-07-18T05:46:45.347628",{"slug":4135,"name":4135,"fn":4136,"description":4137,"org":4138,"tags":4139,"stars":23,"repoUrl":24,"updatedAt":4147},"caching","configure HTTP caching for tRPC queries","Set HTTP cache headers on tRPC query responses via responseMeta callback for CDN and browser caching. Configure Cache-Control, s-maxage, stale-while-revalidate. Handle caching with batching and authenticated requests. Avoid caching mutations, errors, and authenticated responses.\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[4140,4141,4143,4146],{"name":13,"slug":14,"type":15},{"name":4142,"slug":4135,"type":15},"Caching",{"name":4144,"slug":4145,"type":15},"Performance","performance",{"name":9,"slug":8,"type":15},"2026-07-18T05:46:45.86443",24,{"items":4150,"total":4148},[4151,4158,4165,4172,4180,4187,4194,4201,4213,4220,4230,4241],{"slug":4047,"name":4047,"fn":4048,"description":4049,"org":4152,"tags":4153,"stars":23,"repoUrl":24,"updatedAt":4060},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[4154,4155,4156,4157],{"name":4053,"slug":4054,"type":15},{"name":4056,"slug":4057,"type":15},{"name":13,"slug":14,"type":15},{"name":9,"slug":8,"type":15},{"slug":4062,"name":4062,"fn":4063,"description":4064,"org":4159,"tags":4160,"stars":23,"repoUrl":24,"updatedAt":4073},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[4161,4162,4163,4164],{"name":4053,"slug":4054,"type":15},{"name":13,"slug":14,"type":15},{"name":4070,"slug":4071,"type":15},{"name":9,"slug":8,"type":15},{"slug":4075,"name":4075,"fn":4076,"description":4077,"org":4166,"tags":4167,"stars":23,"repoUrl":24,"updatedAt":4086},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[4168,4169,4170,4171],{"name":4053,"slug":4054,"type":15},{"name":13,"slug":14,"type":15},{"name":4083,"slug":4084,"type":15},{"name":9,"slug":8,"type":15},{"slug":4088,"name":4088,"fn":4089,"description":4090,"org":4173,"tags":4174,"stars":23,"repoUrl":24,"updatedAt":4106},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[4175,4176,4177,4178,4179],{"name":4094,"slug":4095,"type":15},{"name":4097,"slug":4098,"type":15},{"name":4100,"slug":4101,"type":15},{"name":9,"slug":8,"type":15},{"name":4104,"slug":4105,"type":15},{"slug":4108,"name":4108,"fn":4109,"description":4110,"org":4181,"tags":4182,"stars":23,"repoUrl":24,"updatedAt":4119},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[4183,4184,4185,4186],{"name":4053,"slug":4054,"type":15},{"name":13,"slug":14,"type":15},{"name":4116,"slug":4117,"type":15},{"name":9,"slug":8,"type":15},{"slug":4121,"name":4121,"fn":4122,"description":4123,"org":4188,"tags":4189,"stars":23,"repoUrl":24,"updatedAt":4133},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[4190,4191,4192,4193],{"name":4127,"slug":4121,"type":15},{"name":4129,"slug":4130,"type":15},{"name":13,"slug":14,"type":15},{"name":9,"slug":8,"type":15},{"slug":4135,"name":4135,"fn":4136,"description":4137,"org":4195,"tags":4196,"stars":23,"repoUrl":24,"updatedAt":4147},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[4197,4198,4199,4200],{"name":13,"slug":14,"type":15},{"name":4142,"slug":4135,"type":15},{"name":4144,"slug":4145,"type":15},{"name":9,"slug":8,"type":15},{"slug":4202,"name":4202,"fn":4203,"description":4204,"org":4205,"tags":4206,"stars":23,"repoUrl":24,"updatedAt":4212},"client-setup","set up vanilla tRPC clients","Create a vanilla tRPC client with createTRPCClient\u003CAppRouter>(), configure link chain with httpBatchLink\u002FhttpLink, dynamic headers for auth, transformer on links (not client constructor). Infer types with inferRouterInputs and inferRouterOutputs. AbortController signal support. TRPCClientError typing.\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[4207,4208,4211],{"name":4053,"slug":4054,"type":15},{"name":4209,"slug":4210,"type":15},"Frontend","frontend",{"name":9,"slug":8,"type":15},"2026-07-18T05:48:11.437946",{"slug":4,"name":4,"fn":5,"description":6,"org":4214,"tags":4215,"stars":23,"repoUrl":24,"updatedAt":25},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[4216,4217,4218,4219],{"name":13,"slug":14,"type":15},{"name":21,"slug":22,"type":15},{"name":9,"slug":8,"type":15},{"name":17,"slug":18,"type":15},{"slug":4221,"name":4221,"fn":4222,"description":4223,"org":4224,"tags":4225,"stars":23,"repoUrl":24,"updatedAt":4229},"links","configure tRPC client link chains","Configure the tRPC client link chain: httpLink, httpBatchLink, httpBatchStreamLink, splitLink, loggerLink, wsLink, createWSClient, httpSubscriptionLink, unstable_localLink, retryLink. Choose the right terminating link. Route subscriptions via splitLink. Build custom links for SOA routing. Link options: url, headers, transformer, maxURLLength, maxItems, connectionParams, EventSource ponyfill.\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[4226,4227,4228],{"name":4053,"slug":4054,"type":15},{"name":4209,"slug":4210,"type":15},{"name":9,"slug":8,"type":15},"2026-07-18T05:47:06.847309",{"slug":4024,"name":4024,"fn":4231,"description":4232,"org":4233,"tags":4234,"stars":23,"repoUrl":24,"updatedAt":4240},"compose middleware for tRPC procedures","Create and compose tRPC middleware with t.procedure.use(), extend context via opts.next({ ctx }), build reusable middleware with .concat() and .unstable_pipe(), define base procedures like publicProcedure and authedProcedure. Access raw input with getRawInput(). Logging, timing, OTEL tracing patterns.\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[4235,4236,4239],{"name":13,"slug":14,"type":15},{"name":4237,"slug":4238,"type":15},"Middleware","middleware",{"name":9,"slug":8,"type":15},"2026-07-18T05:46:49.132255",{"slug":4242,"name":4242,"fn":4243,"description":4244,"org":4245,"tags":4246,"stars":23,"repoUrl":24,"updatedAt":4254},"nextjs-app-router","implement tRPC in Next.js App Router","Full end-to-end tRPC setup for Next.js App Router. Covers route handler with fetchRequestHandler (GET + POST exports), TRPCProvider with QueryClientProvider, createTRPCOptionsProxy for RSC prefetching, HydrateClient\u002FHydrationBoundary for hydration, useSuspenseQuery for Suspense, and server-side callers.\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[4247,4248,4249,4252,4253],{"name":13,"slug":14,"type":15},{"name":4209,"slug":4210,"type":15},{"name":4250,"slug":4251,"type":15},"Next.js","next-js",{"name":9,"slug":8,"type":15},{"name":17,"slug":18,"type":15},"2026-07-18T05:47:10.468453"]