{"record":{"id":"e597d49391734bde","repo":"RocketChat/Rocket.Chat","slug":"error-invalid-provider","errorCode":"error-invalid-provider","errorMessage":"error-invalid-provider","messagePattern":"error-invalid-provider","errorType":"exception","errorClass":"Error","httpStatus":400,"severity":"error","filePath":"apps/meteor/ee/server/api/v1/omnichannel/lib/outbound.ts","lineNumber":40,"sourceCode":"\t\treturn this.provider;\n\t}\n\n\tprivate isProviderValid(type: any): type is ValidOutboundProvider {\n\t\treturn ValidOutboundProviderList.includes(type);\n\t}\n\n\tpublic listOutboundProviders(type?: string): IOutboundProvider[] {\n\t\tif (type !== undefined && !this.isProviderValid(type)) {\n\t\t\tthrow new Error('Invalid type');\n\t\t}\n\n\t\treturn this.provider.getOutboundMessageProviders(type);\n\t}\n\n\tpublic getProviderMetadata(providerId: string): Promise<IOutboundProviderMetadata> {\n\t\tconst provider = this.provider.findOneByProviderId(providerId);\n\t\tif (!provider) {\n\t\t\tthrow new Error('error-invalid-provider');\n\t\t}\n\n\t\treturn this.getProviderManager().getProviderMetadata(provider.appId, provider.type);\n\t}\n\n\tprivate getProviderManager() {\n\t\tif (!Apps.self?.isLoaded()) {\n\t\t\tthrow new Error('apps-engine-not-loaded');\n\t\t}\n\n\t\tconst manager = Apps.self?.getManager()?.getOutboundCommunicationProviderManager();\n\t\tif (!manager) {\n\t\t\tthrow new Error('apps-engine-not-configured-correctly');\n\t\t}\n\n\t\treturn manager;\n\t}\n","sourceCodeStart":22,"sourceCodeEnd":58,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0/apps/meteor/ee/server/api/v1/omnichannel/lib/outbound.ts#L22-L58","documentation":"getProviderMetadata(providerId) resolves the registration via OutboundMessageProvider.findOneByProviderId; when nothing is registered under that id it throws 'error-invalid-provider'. Providers are registered by apps, so uninstalling or disabling the owning app removes the registration and orphans stored ids.","triggerScenarios":"Metadata request for a providerId that is stale (owning app uninstalled/disabled), typo'd, or requested before the app finished registering its outbound provider.","commonSituations":"Persisted provider ids in integration config surviving an app uninstall; reinstalling an app without re-registering; ids copied between environments.","solutions":["Reinstall or re-enable the app that owns the provider so it re-registers","List current providers with listOutboundProviders() and use a live providerId","Drop stored references whenever app uninstall/disable events fire"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const provider = await outboundMessageProvider.outboundMessageProvider.findOneByProviderId(providerId);\nif (!provider) {\n  throw new Error(`no outbound provider '${providerId}' - reinstall the owning app or pick a live id`);\n}\nawait outboundMessageProvider.getProviderMetadata(providerId);","typeGuard":null,"tryCatchPattern":"try {\n  return await outboundMessageProvider.getProviderMetadata(providerId);\n} catch (error) {\n  if (error instanceof Error && error.message === 'error-invalid-provider') {\n    const live = outboundMessageProvider.listOutboundProviders();\n    throw new NotFoundError(`provider '${providerId}' not registered; available: ${live.map((p) => p._id).join(', ')}`);\n  }\n  throw error;\n}","preventionTips":["Resolve provider ids dynamically via listOutboundProviders, not from stale config","Invalidate stored provider ids when apps are uninstalled or disabled","After app reinstall, verify the provider re-registered before use"],"tags":["omnichannel","outbound","apps-engine","not-found"],"backgroundTag":"resource-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"}