medusajs/medusa · warning

Config is missing a label.

Error message

Config is missing a label.

What it means

When generating menu items from route config files (src/admin/routes/**/config.ts-style files or page configs), the plugin reads a `label` used for the sidebar menu entry. A missing label means the menu item would render empty, so the plugin warns (but still generates the item).

Source

Thrown at packages/admin/admin-vite-plugin/src/routes/generate-menu-items.ts:110

}

async function getMenuItemResults(files: string[]): Promise<MenuItemResult[]> {
  const results = await Promise.all(files.map(parseFile))
  return results.filter((item): item is MenuItemResult => item !== null)
}

async function parseFile(
  file: string,
  index: number
): Promise<MenuItemResult | null> {
  const config = await getRouteConfig(file)

  if (!config) {
    return null
  }

  if (!config.label) {
    logger.warn(`Config is missing a label.`, {
      file,
    })
  }

  const import_ = generateImport(file, index)
  const menuItem = generateMenuItem(config, file, index)

  return {
    import: import_,
    menuItem,
  }
}

function generateImport(file: string, index: number): string {
  const path = normalizePath(file)
  return `import { config as ${generateRouteConfigName(index)} } from "${path}"`
}

View on GitHub (pinned to 5e06e544a2)

Solutions

  1. Add `label: "..."` to the route config export
  2. Use defineRouteConfig to get type checking that flags missing fields
  3. Restart the dev server

Example fix

// before
export const config = { icon: Home }

// after
export const config = defineRouteConfig({ label: "Home", icon: Home })
Defensive patterns

Strategy: type-guard

Type guard

const hasLabel = (c: unknown): c is { label: string } =>
  typeof c === "object" && c !== null && typeof (c as any).label === "string" && (c as any).label.length > 0

Prevention

When it happens

Trigger: A route config object exported without a `label` property, e.g. `export const config = { icon: ... }` in an admin routes directory.

Common situations: Route config created from an incomplete snippet; label renamed to `title` or `name` by mistake.

Related errors


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