{"record":{"id":"e597d49391734bde","repo":"RocketChat/Rocket.Chat","slug":"error-invalid-provider","errorCode":null,"errorMessage":"error-invalid-provider","messagePattern":"error-invalid-provider","errorType":"exception","errorClass":"Error","httpStatus":null,"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/f9d3ec372bb580fa8d036f94cf03925a478ef768/apps/meteor/ee/server/api/v1/omnichannel/lib/outbound.ts#L22-L58","documentation":"Thrown by OutboundMessageProviderService.getProviderMetadata (and sendMessage) when OutboundMessageProvider.findOneByProviderId(providerId) returns null. The providerId must reference a registered outbound message provider document. Plain Error, code 'error-invalid-provider'.","triggerScenarios":"Calling getProviderMetadata(providerId) or sendMessage(providerId, ...) with an id that does not match any OutboundMessageProvider document; provider was uninstalled/deactivated; id typo; cross-workspace id leak.","commonSituations":"App providing the outbound integration was uninstalled; provider record soft-deleted; id from a different workspace; stale id cached client-side.","solutions":["List providers first (listOutboundProviders) and confirm the providerId is present.","Re-install/re-enable the app that registers the provider.","Refresh cached provider ids after app lifecycle changes (install/uninstall/enable).","Pass the providerId exactly as returned by the listing API."],"exampleFix":"// before: assume provider exists\nconst meta = svc.getProviderMetadata(providerId);\n\n// after: verify presence\nconst providers = svc.listOutboundProviders();\nif (!providers.some(p => p.providerId === providerId)) {\n  throw new NotFoundError('outbound provider');\n}\nconst meta = svc.getProviderMetadata(providerId);","handlingStrategy":"validation","validationCode":"// Confirm provider is registered before use\nconst providers = svc.listOutboundProviders();\nif (!providers.some(p => p.providerId === providerId)) {\n  throw new NotFoundError('outbound provider');\n}\nawait svc.getProviderMetadata(providerId);","typeGuard":"function isKnownProvider(providers: IOutboundProvider[], id: string): boolean {\n  return providers.some(p => p.providerId === id);\n}","tryCatchPattern":"try {\n  return await svc.getProviderMetadata(providerId);\n} catch (e) {\n  if (e.message === 'error-invalid-provider') {\n    // refresh provider list; if still missing, prompt reinstall of the providing app\n    await refreshProviders();\n    return null;\n  }\n  throw e;\n}","preventionTips":["Refresh cached provider ids after any app install/uninstall/enable/disable.","Store the providerId exactly as returned by the listing API."],"tags":["omnichannel","outbound","apps-engine","not-found"],"backgroundTag":null,"analyzedSha":"f9d3ec372bb580fa8d036f94cf03925a478ef768","analyzedAt":"2026-08-12T19:07:17.372Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}