{"record":{"id":"41634e6a39eda3ed","repo":"RocketChat/Rocket.Chat","slug":"creating-normal-users-is-currently-not-supported","errorCode":null,"errorMessage":"Creating normal users is currently not supported","messagePattern":"Creating normal users is currently not supported","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"apps/meteor/app/apps/server/bridges/users.ts","lineNumber":105,"sourceCode":"\t\t}\n\n\t\tswitch (user.type) {\n\t\t\tcase 'bot':\n\t\t\tcase 'app':\n\t\t\t\tif (!(await checkUsernameAvailability(user.username as string))) {\n\t\t\t\t\tthrow new Error(`The username \"${user.username}\" is already being used. Rename or remove the user using it to install this App`);\n\t\t\t\t}\n\n\t\t\t\tawait Users.insertOne(user);\n\n\t\t\t\tif (options?.avatarUrl) {\n\t\t\t\t\tawait setUserAvatar(user, options.avatarUrl, '', 'local');\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\tthrow new Error('Creating normal users is currently not supported');\n\t\t}\n\n\t\tvoid notifyOnUserChangeById({ clientAction: 'inserted', id: user._id });\n\n\t\treturn user._id;\n\t}\n\n\tprotected async remove(user: IUser & { id: string }, appId: string): Promise<boolean> {\n\t\tthis.orch.debugLog(`The App's user is being removed: ${appId}`);\n\n\t\t// It's actually not a problem if there is no App user to delete - just means we don't need to do anything more.\n\t\tif (!user) {\n\t\t\treturn true;\n\t\t}\n\n\t\ttry {\n\t\t\tawait deleteUser(user.id);\n\t\t} catch (err) {","sourceCodeStart":87,"sourceCodeEnd":123,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/f9d3ec372bb580fa8d036f94cf03925a478ef768/apps/meteor/app/apps/server/bridges/users.ts#L87-L123","documentation":"Thrown by the users bridge create method when user.type is anything other than 'bot' or 'app'. The bridge explicitly supports creating only bot/app users (app-owned identities); the default branch of the switch rejects any other type, including normal human users.","triggerScenarios":"App calls create with a user whose type is undefined, 'user', or any value outside {'bot','app'}. The switch falls through to the default branch and throws.","commonSituations":"App author tries to provision human users via the Apps Engine; user object built without setting type; type field populated from an external source that uses different enum values.","solutions":["Set user.type to 'bot' or 'app' when creating users through the Apps Engine.","Use the REST API or a server-side migration for provisioning real human users — the Apps Engine intentionally forbids it.","Validate the type field before calling create."],"exampleFix":"// before\nconst u: IUser = { name, username, type: 'user' };\nawait users.create(u);\n\n// after\nconst u: IUser = { name, username, type: 'bot' };\nawait users.create(u);","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"function isAppUserType(type: string): boolean {\n  return type === 'bot' || type === 'app';\n}","tryCatchPattern":null,"preventionTips":["Only create bot/app users via the Apps Engine.","Provision human users through the REST API, not the bridge.","Set user.type explicitly to 'bot' or 'app'."],"tags":["apps-engine","users","not-supported","bot","validation"],"backgroundTag":null,"analyzedSha":"f9d3ec372bb580fa8d036f94cf03925a478ef768","analyzedAt":"2026-08-12T19:07:17.372Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}