RocketChat/Rocket.Chat · error · Error

error-invalid-provider

Error message

error-invalid-provider

What it means

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'.

Source

Thrown at apps/meteor/ee/server/api/v1/omnichannel/lib/outbound.ts:40

		return this.provider;
	}

	private isProviderValid(type: any): type is ValidOutboundProvider {
		return ValidOutboundProviderList.includes(type);
	}

	public listOutboundProviders(type?: string): IOutboundProvider[] {
		if (type !== undefined && !this.isProviderValid(type)) {
			throw new Error('Invalid type');
		}

		return this.provider.getOutboundMessageProviders(type);
	}

	public getProviderMetadata(providerId: string): Promise<IOutboundProviderMetadata> {
		const provider = this.provider.findOneByProviderId(providerId);
		if (!provider) {
			throw new Error('error-invalid-provider');
		}

		return this.getProviderManager().getProviderMetadata(provider.appId, provider.type);
	}

	private getProviderManager() {
		if (!Apps.self?.isLoaded()) {
			throw new Error('apps-engine-not-loaded');
		}

		const manager = Apps.self?.getManager()?.getOutboundCommunicationProviderManager();
		if (!manager) {
			throw new Error('apps-engine-not-configured-correctly');
		}

		return manager;
	}

View on GitHub (pinned to f9d3ec372b)

Solutions

  1. List providers first (listOutboundProviders) and confirm the providerId is present.
  2. Re-install/re-enable the app that registers the provider.
  3. Refresh cached provider ids after app lifecycle changes (install/uninstall/enable).
  4. Pass the providerId exactly as returned by the listing API.

Example fix

// before: assume provider exists
const meta = svc.getProviderMetadata(providerId);

// after: verify presence
const providers = svc.listOutboundProviders();
if (!providers.some(p => p.providerId === providerId)) {
  throw new NotFoundError('outbound provider');
}
const meta = svc.getProviderMetadata(providerId);
Defensive patterns

Strategy: validation

Validate before calling

// Confirm provider is registered before use
const providers = svc.listOutboundProviders();
if (!providers.some(p => p.providerId === providerId)) {
  throw new NotFoundError('outbound provider');
}
await svc.getProviderMetadata(providerId);

Type guard

function isKnownProvider(providers: IOutboundProvider[], id: string): boolean {
  return providers.some(p => p.providerId === id);
}

Try / catch

try {
  return await svc.getProviderMetadata(providerId);
} catch (e) {
  if (e.message === 'error-invalid-provider') {
    // refresh provider list; if still missing, prompt reinstall of the providing app
    await refreshProviders();
    return null;
  }
  throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: App providing the outbound integration was uninstalled; provider record soft-deleted; id from a different workspace; stale id cached client-side.

Related errors


AI-assisted analysis of RocketChat/Rocket.Chat@f9d3ec372b (2026-08-12). Data as JSON: /api/errors/e597d49391734bde. Report an issue: GitHub.