{"record":{"id":"9ac99cb22d0eb33f","repo":"sveltejs/kit","slug":"the-message-property-of-handleerror-is-depreca","errorCode":null,"errorMessage":"The `message` property of `handleError` is deprecated. Use `error.message` for expected and framework errors, or 'Internal Error' for unexpected errors.","messagePattern":"The `message` property of `handleError` is deprecated\\. Use `error\\.message` for expected and framework errors, or 'Internal Error' for unexpected errors\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/kit/src/utils/error.js","lineNumber":65,"sourceCode":" * properties of the `handleError` hook input.\n * @template {object} T\n * @param {T} input\n * @param {{ status: number; message: string }} fallback\n * @returns {T}\n */\nexport function add_deprecated_handle_error_properties(input, fallback) {\n\tObject.defineProperties(input, {\n\t\tstatus: {\n\t\t\tget() {\n\t\t\t\tconsole.warn(\n\t\t\t\t\t'The `status` property of `handleError` is deprecated. Use `error.status` for expected and framework errors, or `500` for unexpected errors.'\n\t\t\t\t);\n\t\t\t\treturn fallback.status;\n\t\t\t}\n\t\t},\n\t\tmessage: {\n\t\t\tget() {\n\t\t\t\tconsole.warn(\n\t\t\t\t\t\"The `message` property of `handleError` is deprecated. Use `error.message` for expected and framework errors, or 'Internal Error' for unexpected errors.\"\n\t\t\t\t);\n\t\t\t\treturn fallback.message;\n\t\t\t}\n\t\t}\n\t});\n\n\treturn input;\n}\n","sourceCodeStart":47,"sourceCodeEnd":75,"githubUrl":"https://github.com/sveltejs/kit/blob/03f1687fe612ce3d2d9131139b5b188d9cf90c64/packages/kit/src/utils/error.js#L47-L75","documentation":"Like the `status` twin, `message` on the `handleError` error argument is a deprecated getter that warns when read. For unexpected errors the real message is hidden for security, so the getter returns the fallback ('Internal Error'), and developers are told to use `error.message` for expected/framework errors or the literal string otherwise.","triggerScenarios":"Accessing `.message` on the error argument inside `handleError` in hooks.server.js, triggering the getter defined by `add_deprecated_handle_error_properties`.","commonSituations":"Legacy hook code returning `{ message: error.message }`; third-party error trackers serializing the hook argument; templates copied from pre-deprecation docs.","solutions":["Read `error.message` from the original error and provide your own 'Internal Error' fallback for unexpected errors","Update the hook return to compute message explicitly based on error type","Silence noise by removing all reads of the deprecated properties"],"exampleFix":"// before\nreturn { message: error.message };\n// after\nreturn { message: error instanceof Error && 'status' in error ? error.message : 'Internal Error' };","handlingStrategy":"type-guard","validationCode":"function resolveMessage(error) {\n  return error instanceof Error && 'status' in error && error.status != null\n    ? error.message\n    : 'Internal Error';\n}","typeGuard":"function isFrameworkError(error) {\n  return error instanceof Error && typeof error.message === 'string' && 'status' in error;\n}","tryCatchPattern":null,"preventionTips":["Build message explicitly with a fallback literal 'Internal Error'","Avoid blanket serialization of the hook's error argument","Migrate old hook templates from docs/tutorials"],"tags":["deprecation","handleerror","hooks"],"backgroundTag":"deprecated-handle-error-message","analyzedSha":"03f1687fe612ce3d2d9131139b5b188d9cf90c64","analyzedAt":"2026-09-02T02:01:50.504Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}