{"record":{"id":"ab6a4bdbf429ff0f","repo":"medusajs/medusa","slug":"entity-discovery-has-not-been-initialized-please","errorCode":null,"errorMessage":"Entity discovery has not been initialized. Please ensure the application has fully started.","messagePattern":"Entity discovery has not been initialized\\. Please ensure the application has fully started\\.","errorType":"exception","errorClass":"MedusaError","httpStatus":500,"severity":"error","filePath":"packages/medusa/src/api/admin/views/[entity]/columns/route.ts","lineNumber":24,"sourceCode":"import { MedusaError, Modules } from \"@medusajs/framework/utils\"\n\n/**\n * Get available columns for an entity.\n *\n * @since 2.10.3\n * @featureFlag view_configurations\n */\nexport const GET = async (\n  req: AuthenticatedMedusaRequest,\n  res: MedusaResponse<HttpTypes.AdminViewsEntityColumnsResponse>\n) => {\n  const entity = req.params.entity\n\n  const settingsService =\n    req.scope.resolve<SettingsTypes.ISettingsModuleService>(Modules.SETTINGS)\n\n  if (!settingsService.isEntityDiscoveryInitialized()) {\n    throw new MedusaError(\n      MedusaError.Types.UNEXPECTED_STATE,\n      \"Entity discovery has not been initialized. Please ensure the application has fully started.\"\n    )\n  }\n\n  if (!settingsService.hasEntity(entity)) {\n    const availableEntities = await settingsService.listDiscoverableEntities()\n    const entityNames = availableEntities.map((e) => e.pluralName).slice(0, 10)\n\n    throw new MedusaError(\n      MedusaError.Types.INVALID_DATA,\n      `Unsupported entity: ${entity}. Available entities include: ${entityNames.join(\n        \", \"\n      )}${availableEntities.length > 10 ? \"...\" : \"\"}`\n    )\n  }\n\n  const columns = await settingsService.generateEntityColumns(entity)","sourceCodeStart":6,"sourceCodeEnd":42,"githubUrl":"https://github.com/medusajs/medusa/blob/5e06e544a296b9033f20f71f11c559f81a0e5739/packages/medusa/src/api/admin/views/[entity]/columns/route.ts#L6-L42","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","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"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"await waitForAppReady() // poll health endpoint before calling views routes","typeGuard":null,"tryCatchPattern":"retry with backoff until discovery initialized","preventionTips":["Gate requests on a readiness/health check","In tests, wait for bootstrap completion"],"tags":["settings","entity-discovery","startup","views"],"backgroundTag":"service-not-initialized","analyzedSha":"5e06e544a296b9033f20f71f11c559f81a0e5739","analyzedAt":"2026-08-27T07:24:39.599Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}