RocketChat/Rocket.Chat · error
The user for app is not registered.
Error message
The user for app ${appId} is not registered. What it means
AppOAuthAppsBridge.create resolves the calling app's bot user with Users.findOne({ appId }) to attach the OAuth client to a real user; if no user document carries that appId the OAuth app cannot be created and the bridge throws. The message interpolates the appId so you can tell which app failed.
Solutions
- Reinstall (or disable and re-enable) the app so Rocket.Chat re-provisions its bot user
- Verify a user document with field appId equal to your appId exists (Administration → Users, or a direct mongo query on the users collection)
- Never delete the bot user created for an installed app
- If it persists on a stock install, report upstream with the appId from the error message
Defensive patterns
Strategy: try-catch
Try / catch
try {
const clientId = await app.getRocketChat().getOAuthApps().create(oauthAppParams);
app.getLogger().info('oauth app created', clientId);
} catch (err) {
if (err instanceof Error && err.message.includes('is not registered')) {
// bot user missing: surface instructions or retry after reinstall
app.getLogger().error('App bot user missing — reinstall the app to re-provision it');
return;
}
throw err;
} Prevention
- Create OAuth clients lazily (on first use), not in onInstall, to avoid racing bot-user provisioning
- Never delete the bot user belonging to an installed app
- After workspace DB restores, re-enable/reinstall apps before they run
- Include the appId from the error message when reporting issues
When it happens
Trigger: An app creates an OAuth client during install/activation before its bot user was provisioned; the bot user was deleted from Administration → Users; the database was restored/reset while the app remained installed; an appId mismatch between the app record and the user document.
Common situations: Apps that register OAuth clients in onInstall/onActivate; dev workspaces after mongo resets or migrations; operators cleaning up 'app bot' users manually; partial/failed app installations.
Related errors
- App already exists.
- Errors occurred while deleting an app user
- Invalid user
- The username " " is already being used. Rename or remove…
- 401
AI-assisted analysis of RocketChat/Rocket.Chat@b2c16d5842 (2026-08-18).
Data as JSON: /api/errors/fbadff9cb6ba64f0.
Report an issue: GitHub.
Appendix: source
Thrown at apps/meteor/app/apps/server/bridges/oauthApps.ts:21
import type { IAppServerOrchestrator } from '@rocket.chat/apps';
import { OAuthAppsBridge } from '@rocket.chat/apps/dist/server/bridges/OAuthAppsBridge';
import type { IOAuthApp, IOAuthAppParams } from '@rocket.chat/apps-engine/definition/accessors/IOAuthApp';
import type { IOAuthApps } from '@rocket.chat/core-typings';
import { OAuthApps, Users } from '@rocket.chat/models';
import { Random } from '@rocket.chat/random';
export class AppOAuthAppsBridge extends OAuthAppsBridge {
constructor(private readonly orch: IAppServerOrchestrator) {
super();
}
protected async create(oAuthApp: IOAuthAppParams, appId: string): Promise<string | null> {
this.orch.debugLog(`The App ${appId} is creating a new OAuth app.`);
const { clientId, clientSecret } = oAuthApp;
const botUser = await Users.findOne({ appId });
if (!botUser) {
throw new Error(`The user for app ${appId} is not registered.`);
}
const { _id, username } = botUser;
return (
await OAuthApps.insertOne({
...oAuthApp,
_id: randomUUID(),
appId,
clientId: clientId ?? Random.id(),
clientSecret: clientSecret ?? Random.secret(),
_createdAt: new Date(),
_createdBy: {
_id,
username,
},
} as unknown as IOAuthApps)
).insertedId;View on GitHub (pinned to b2c16d5842)