medusajs/medusa · error · MedusaError
Entity discovery has not been initialized. Please ensure…
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.
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: . Available entities include
- [caching-redis] redisUrl is required
- Github callbackUrl is required
- Github clientId is required
- Github clientSecret is required
AI-assisted analysis of medusajs/medusa@5e06e544a2 (2026-08-27).
Data as JSON: /api/errors/ab6a4bdbf429ff0f.
Report an issue: GitHub.
Appendix: 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)