medusajs/medusa · error · MedusaError

Entity discovery has not been initialized. Please ensure the

Error message

Entity discovery has not been initialized. Please ensure the application has fully started.

What it means

Thrown by GET /admin/views/:entity/columns when the settings module's entity discovery has not been initialized. Column generation depends on discovery metadata populated during application startup.

Source

Thrown at packages/medusa/src/api/admin/views/[entity]/columns/route.ts:24

import { MedusaError, Modules } from "@medusajs/framework/utils"

/**
 * Get available columns for an entity.
 *
 * @since 2.10.3
 * @featureFlag view_configurations
 */
export const GET = async (
  req: AuthenticatedMedusaRequest,
  res: MedusaResponse<HttpTypes.AdminViewsEntityColumnsResponse>
) => {
  const entity = req.params.entity

  const settingsService =
    req.scope.resolve<SettingsTypes.ISettingsModuleService>(Modules.SETTINGS)

  if (!settingsService.isEntityDiscoveryInitialized()) {
    throw new MedusaError(
      MedusaError.Types.UNEXPECTED_STATE,
      "Entity discovery has not been initialized. Please ensure the application has fully started."
    )
  }

  if (!settingsService.hasEntity(entity)) {
    const availableEntities = await settingsService.listDiscoverableEntities()
    const entityNames = availableEntities.map((e) => e.pluralName).slice(0, 10)

    throw new MedusaError(
      MedusaError.Types.INVALID_DATA,
      `Unsupported entity: ${entity}. Available entities include: ${entityNames.join(
        ", "
      )}${availableEntities.length > 10 ? "..." : ""}`
    )
  }

  const columns = await settingsService.generateEntityColumns(entity)

View on GitHub (pinned to 5e06e544a2)

Solutions

  1. Ensure the application is fully started before calling the endpoint (await loader/lifecycle initialization)
  2. Check startup logs for settings-module or entity-discovery failures
  3. In tests, wait for app readiness before issuing requests
Defensive patterns

Strategy: retry

Validate before calling

await waitForAppReady() // poll health endpoint before calling views routes

Try / catch

retry with backoff until discovery initialized

Prevention

When it happens

Trigger: Calling the endpoint before app startup completes, or when the settings module discovery step failed or was skipped (e.g. migrations run programmatically, custom bootstrapping, or a failed plugin load).

Common situations: Integration tests hitting routes before full bootstrap; custom server setups that start listening before Medusa's lifecycle hooks finish; errors during entity discovery silently swallowed at boot.

Related errors


AI-assisted analysis of medusajs/medusa@5e06e544a2 (2026-08-27). Data as JSON: /api/errors/ab6a4bdbf429ff0f. Report an issue: GitHub.