{"record":{"id":"aca5707ef0657230","repo":"RocketChat/Rocket.Chat","slug":"invalid-app-provided","errorCode":null,"errorMessage":"Invalid app provided","messagePattern":"Invalid app provided","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"apps/meteor/app/apps/server/bridges/uiInteraction.ts","lineNumber":19,"sourceCode":"import type { IAppServerOrchestrator } from '@rocket.chat/apps';\nimport { UiInteractionBridge as AppsEngineUiInteractionBridge } from '@rocket.chat/apps/dist/server/bridges/UiInteractionBridge';\nimport type { IUIKitInteraction } from '@rocket.chat/apps-engine/definition/uikit';\nimport type { IUser } from '@rocket.chat/apps-engine/definition/users';\nimport { api } from '@rocket.chat/core-services';\nimport type * as UiKit from '@rocket.chat/ui-kit';\n\nexport class UiInteractionBridge extends AppsEngineUiInteractionBridge {\n\tconstructor(private readonly orch: IAppServerOrchestrator) {\n\t\tsuper();\n\t}\n\n\tprotected async notifyUser(user: IUser, interaction: IUIKitInteraction, appId: string): Promise<void> {\n\t\tthis.orch.debugLog(`The App ${appId} is sending an interaction to user.`);\n\n\t\tconst app = this.orch.getManager()?.getOneById(appId);\n\n\t\tif (!app) {\n\t\t\tthrow new Error('Invalid app provided');\n\t\t}\n\n\t\tvoid api.broadcast('notify.uiInteraction', user.id, interaction as UiKit.ServerInteraction);\n\t}\n}\n","sourceCodeStart":1,"sourceCodeEnd":25,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0/apps/meteor/app/apps/server/bridges/uiInteraction.ts#L1-L25","documentation":"UiInteractionBridge.notifyUser resolves the calling app through the orchestrator's app manager before broadcasting a UIKit interaction to a user; when getOneById(appId) returns undefined the bridge throws 'Invalid app provided'. The appId on the call does not match any currently loaded app.","triggerScenarios":"App sends a UIKit interaction (notifyUser) while being uninstalled, disabled, or reloaded; appId is malformed or hard-coded; a queued/scheduled interaction is flushed after the app was removed.","commonSituations":"Scheduled notifications outliving the app instance; dev-mode hot reload dropping the app from the manager; app ids persisted across reinstalls (reinstall generates a new identity).","solutions":["Only send interactions as the running app: use the runtime app id, never a persisted or hard-coded one.","Guard scheduled tasks: verify the app is still active before pushing UI updates.","If the app was reinstalled, refresh any stored references to its id."],"exampleFix":"// before\nconst appId = persistedAppId; // stale after reinstall\nawait notifyUser(user, interaction, appId);\n\n// after\nconst appId = this.getAppId(); // identity of the running app instance\nawait notifyUser(user, interaction, appId);","handlingStrategy":"validation","validationCode":"const appId = this.getAppId();\nif (!appId) {\n  return; // not running inside an active app context\n}","typeGuard":"const isNonEmptyString = (v: unknown): v is string =>\n  typeof v === 'string' && v.trim().length > 0;","tryCatchPattern":"Catch and drop with a log line: the sender app no longer exists, so the interaction cannot be delivered.","preventionTips":["Always use the runtime app id, never a persisted one.","Cancel timers/schedulers in the uninstall/disable lifecycle hook.","Refresh stored app references after reinstalling an app."],"tags":["apps-engine","uikit","interaction","app-lifecycle"],"backgroundTag":"app-not-found","analyzedSha":"b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0","analyzedAt":"2026-08-18T15:26:39.429Z","contentChangedAt":"2026-08-18T15:26:39.429Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}