{"record":{"id":"e1f7e4c4b3d09e88","repo":"RocketChat/Rocket.Chat","slug":"string-e","errorCode":null,"errorMessage":"String(e)","messagePattern":"String\\(e\\)","errorType":"exception","errorClass":"Meteor.Error","httpStatus":null,"severity":"error","filePath":"apps/meteor/server/meteor-methods/users/registerUser.ts","lineNumber":119,"sourceCode":"\t\temail: trim(formData.email.toLowerCase()),\n\t\tpassword: formData.pass,\n\t\t...(formData.name?.trim() && { name: formData.name?.trim() }),\n\t\treason: formData.reason,\n\t};\n\n\tlet userId;\n\ttry {\n\t\tuserId = await Accounts.createUserAsync(userData);\n\t} catch (e) {\n\t\tif (e instanceof Meteor.Error) {\n\t\t\tthrow e;\n\t\t}\n\n\t\tif (e instanceof Error) {\n\t\t\tthrow new Meteor.Error(e.message);\n\t\t}\n\n\t\tthrow new Meteor.Error(String(e));\n\t}\n\n\tconst reason = trim(formData.reason);\n\tif (manuallyApproveNewUsers && reason) {\n\t\tawait Users.setReason(userId, reason);\n\t}\n\n\ttry {\n\t\tAccounts.sendVerificationEmail(userId, userData.email);\n\t} catch (error) {\n\t\t// throw new Meteor.Error 'error-email-send-failed', 'Error trying to send email: ' + error.message, { method: 'registerUser', message: error.message }\n\t}\n\n\treturn userId;\n};\n\nMeteor.methods<ServerMethods>({\n\tasync registerUser(formData) {","sourceCodeStart":101,"sourceCodeEnd":137,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0/apps/meteor/server/meteor-methods/users/registerUser.ts#L101-L137","documentation":"Last-resort rethrow in registerUser's catch: Accounts.createUserAsync rejected with a value that is neither a Meteor.Error nor an Error (e.g. a raw string, object, or number from a badly-written async hook). The value is stringified into the error text, so the client receives a Meteor.Error whose 'error' field is that string and there is no meaningful code. Encountering this almost always means a custom hook is rejecting with a non-Error value.","triggerScenarios":"A package or app hook does `throw 'user limit reached'` or rejects a promise with a plain object; a corrupted driver callback invoking the callback with an object instead of an Error; outdated community packages incompatible with createUserAsync's promise API.","commonSituations":"Legacy plugins written for callback-style accounts APIs after migration to async; third-party license/quota plugins throwing strings.","solutions":["Find the rejection source: log the stringified value server-side; it usually names the plugin that threw it.","Fix the offending hook to reject with `new Meteor.Error(code, reason)` (or at least a real Error).","Update or remove legacy accounts-related packages that still use callback-style or throw non-Error values."],"exampleFix":"// before: hook rejects with a string -> Meteor.Error(String(e))\nasync function quotaHook() { throw 'user limit reached'; }\n\n// after: reject with a coded Meteor.Error\nasync function quotaHook() { throw new Meteor.Error('error-user-limit-reached', 'License user limit reached'); }","handlingStrategy":"try-catch","validationCode":null,"typeGuard":"const isMeteorError = (e: unknown): e is Meteor.Error =>\n  typeof e === 'object' && e !== null && 'error' in e && 'reason' in e;","tryCatchPattern":"try {\n  await Meteor.callAsync('registerUser', formData);\n} catch (e) {\n  // Stringified non-Error rejections land in (e as Meteor.Error).error with no 'error-*' code\n  const raw = (e as Meteor.Error).error;\n  if (typeof raw === 'string' && !raw.startsWith('error-')) {\n    logRemote('registerUser: plugin rejected with non-Error value', { raw });\n    showError('Registration blocked: ' + raw);\n  }\n}","preventionTips":["Enforce that all accounts hooks reject with Error/Meteor.Error instances (lint rule or code review)","Log the stringified value server-side to identify the offending plugin quickly","Keep accounts-related community packages updated for async createUser compatibility"],"tags":["registration","accounts","error-wrapping","plugin-compatibility"],"backgroundTag":"user-creation-failed","analyzedSha":"b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0","analyzedAt":"2026-08-18T15:26:39.429Z","contentChangedAt":"2026-08-18T15:26:39.429Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}