RocketChat/Rocket.Chat · error · Error

apps-engine-not-initialized

apps-engine-not-initialized

Error message

apps-engine-not-initialized

What it means

Thrown by _canEnableApp (license/canEnableApp.ts:15) when Apps.isInitialized() returns false — the Apps Engine has not finished initializing. It is the first check in the enable-app gate, so it precedes any license/addon logic. Plain Error. Migrated apps are not exempt here because this check runs before the migrated-app short-circuit.

Source

Thrown at apps/meteor/ee/server/lib/license/canEnableApp.ts:15

import type { IAppStorageItem } from '@rocket.chat/apps/dist/server/storage/IAppStorageItem';
import { Apps } from '@rocket.chat/core-services';
import type { LicenseModule } from '@rocket.chat/core-typings';
import { License, type LicenseImp } from '@rocket.chat/license';

import { getInstallationSourceFromAppStorageItem } from '../../../../lib/apps/getInstallationSourceFromAppStorageItem';

type _canEnableAppDependencies = {
	Apps: typeof Apps;
	License: LicenseImp;
};

export const _canEnableApp = async ({ Apps, License }: _canEnableAppDependencies, app: IAppStorageItem): Promise<void> => {
	if (!(await Apps.isInitialized())) {
		throw new Error('apps-engine-not-initialized');
	}

	// Migrated apps were installed before the validation was implemented
	// so they're always allowed to be enabled
	if (app.migrated) {
		return;
	}

	if (app.info.addon && !License.hasModule(app.info.addon as LicenseModule)) {
		throw new Error('app-addon-not-valid');
	}

	const source = getInstallationSourceFromAppStorageItem(app);
	switch (source) {
		case 'private':
			if (await License.shouldPreventAction('privateApps')) {
				throw new Error('license-prevented');
			}

View on GitHub (pinned to f9d3ec372b)

Solutions

  1. Wait for the Apps Engine to finish initialization and retry the enable.
  2. Check Apps Engine / apps-engine microservice health and logs for startup failures.
  3. Guard the caller to only enable apps after the 'apps-engine-ready' signal.

Example fix

// before
await canEnableApp(app); // may throw during boot

// after
if (!(await Apps.isInitialized())) {
  return deferUntilAppsReady();
}
await canEnableApp(app);
Defensive patterns

Strategy: validation

Validate before calling

async function ensureAppsReady(): Promise<void> {
  if (!(await Apps.isInitialized())) throw new Error('apps-engine-not-initialized');
}

Type guard

null

Try / catch

try { await canEnableApp(app); } catch (e) {
  if (e instanceof Error && e.message === 'apps-engine-not-initialized') { /* wait for ready signal, then retry */ } else throw e;
}

Prevention

When it happens

Trigger: Calling canEnableApp during server startup before the Apps Engine reports ready; the apps-engine microservice (apps-engine-migration) is not yet wired or has failed to start; an admin action races the boot sequence.

Common situations: Server just restarted and an admin/API call to enable an app landed too early; apps-engine service crashed or is unhealthy; running against a partially-initialized test fixture.

Related errors


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