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
- Ensure the application is fully started before calling the endpoint (await loader/lifecycle initialization)
- Check startup logs for settings-module or entity-discovery failures
- 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
- Gate requests on a readiness/health check
- In tests, wait for bootstrap completion
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
- Unsupported entity: ${entity}. Available entities include: $
- Module ${moduleConfig.resolve} doesn't have a serviceName. P
- Unable to resolve plugin "${pluginPath}". Make sure the plug
- The specified PostgreSQL database does not exist. Please cre
- Migrations missing. Please run 'medusa migrations run' and t
AI-assisted analysis of medusajs/medusa@5e06e544a2 (2026-08-27).
Data as JSON: /api/errors/ab6a4bdbf429ff0f.
Report an issue: GitHub.