RocketChat/Rocket.Chat · error

${result.error}

Error message

${result.error}

What it means

Thrown inside a React Query useQuery queryFn when orchestrator.getAppsFromMarketplace returns a result object whose error property is a string. The marketplace orchestrator returns a union type: either { apps: App[] } on success or { error: string } on failure. The queryFn checks for the error string and throws it so React Query treats the fetch as failed (triggering retry/error state).

Source

Thrown at apps/meteor/client/views/marketplace/hooks/useApps.ts:138

	);

	useEffect(() => {
		return stream('apps', ([key]) => {
			if (['app/added', 'app/removed', 'app/updated', 'app/statusUpdate', 'app/settingUpdated'].includes(key)) {
				invalidate();
			}
			if (['app/added', 'app/removed'].includes(key) && !isEnterprise) {
				invalidateLicenseQuery();
			}
		});
	}, [invalidate, invalidateLicenseQuery, isEnterprise, stream]);

	const marketplace = useQuery({
		queryKey: marketplaceQueryKeys.appsMarketplace(canManageApps),
		queryFn: async () => {
			const result = await orchestrator.getAppsFromMarketplace(canManageApps);
			if (result.error && typeof result.error === 'string') {
				throw new Error(result.error);
			}
			return result.apps;
		},
		staleTime: Infinity,
		placeholderData: keepPreviousData,
	});

	const instance = useQuery({
		queryKey: marketplaceQueryKeys.appsInstance(canManageApps),
		queryFn: async () => {
			const result = await orchestrator.getInstalledApps().then((result: App[]) =>
				result.map((current: App) => ({
					...current,
					installed: true,
				})),
			);
			return result;
		},

View on GitHub (pinned to f9d3ec372b)

Solutions

  1. Read the error string from the thrown Error.message to identify the specific marketplace failure.
  2. Check server logs for the marketplace/App Engine error corresponding to the message.
  3. Verify the marketplace settings (URL, token) are correctly configured in Rocket.Chat admin.
  4. Handle the React Query error state in the UI to show a retry button or fallback.

Example fix

// before: error swallowed or unhandled
const { data, error } = useMarketplace();
// after: handle error state explicitly
const marketplace = useQuery({
  queryFn: async () => {
    const result = await orchestrator.getAppsFromMarketplace(canManageApps);
    if (result.error && typeof result.error === 'string') {
      throw new Error(result.error);
    }
    return result.apps;
  },
  retry: 1,
});
// in component:
if (marketplace.isError) {
  return <ErrorMessage error={marketplace.error} onRetry={() => marketplace.refetch()} />;
}
Defensive patterns

Strategy: try-catch

Validate before calling

const result = await orchestrator.getAppsFromMarketplace(canManageApps);
if (result.error) {
  // pre-check: log the error, show config guidance
  console.warn('Marketplace error:', result.error);
  return;
}

Type guard

const isMarketplaceError = (result: any): result is { error: string } =>
  result && typeof result.error === 'string';

Try / catch

// React Query handles this automatically:
const marketplace = useQuery({
  queryFn: async () => {
    const result = await orchestrator.getAppsFromMarketplace(canManageApps);
    if (result.error && typeof result.error === 'string') {
      throw new Error(result.error);
    }
    return result.apps;
  },
});
// Access the error:
if (marketplace.isError) {
  console.error(marketplace.error?.message);
}

Prevention

When it happens

Trigger: The marketplace API returns an error (e.g., marketplace not configured, network issue, server error, license limitation). The orchestrator fails to fetch apps and returns an error string. The App Engine service is unavailable. The user's license does not permit marketplace access.

Common situations: Marketplace URL not configured or unreachable on the server. App Engine microservice is down or misconfigured. Enterprise license expired or lacks marketplace entitlement. Network connectivity issue between client and server. Server-side rate limiting or timeout.

Related errors


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