medusajs/medusa · warning

'link' property is missing.

Error message

'link' property is missing.

What it means

Companion check to the 'model' warning: the custom-field display generator requires a 'link' property pointing to the module-link definition file that ties the custom model to a core model. Without a parseable link, the plugin cannot wire the display's data and skips the file with this warning.

Source

Thrown at packages/admin/admin-vite-plugin/src/custom-fields/generate-custom-field-displays.ts:173

        displays = getDisplays(path, model, index, file)
        hasLink = validateLink(path, file)
      },
    })
  } catch (err) {
    logger.error(`An error occurred while traversing the file.`, {
      file,
      error: err,
    })
    return null
  }

  if (!model) {
    logger.warn(`'model' property is missing.`, { file })
    return null
  }

  if (!hasLink) {
    logger.warn(`'link' property is missing.`, { file })
    return null
  }

  return {
    import: import_,
    model,
    displays,
  }
}

function getDisplays(
  path: NodePath<ExportDefaultDeclaration>,
  model: CustomFieldModel,
  index: number,
  file: string
): CustomFieldDisplay[] | null {
  const configArgument = getConfigArgument(path)

View on GitHub (pinned to 5e06e544a2)

Solutions

  1. Add link: "<path-to-link-file>" to the default export in the file named in the warning
  2. Confirm the path resolves from the project root and the link module exists and exports a valid model link
  3. Keep the property a plain string literal

Example fix

// before
export default {
  model: "brand",
  displays: [/* ... */],
}

// after
export default {
  model: "brand",
  link: "./src/links/product-brand",
  displays: [/* ... */],
}
Defensive patterns

Strategy: validation

Validate before calling

if (typeof cfg.link !== "string") {
  throw new Error("display config is missing 'link' — it will be skipped")
}

Type guard

const hasDisplayLink = (c: unknown): c is { link: string } =>
  typeof c === "object" && c !== null && typeof (c as any).link === "string"

Try / catch

null

Prevention

When it happens

Trigger: A custom-field display config whose default export lacks the link property (path to the link definition), or where link is present but not statically parseable by the AST-based generator.

Common situations: Copying a display example but omitting the link path; moving link files without updating the path string; using a dynamic/computed value for link the parser can't read.

Related errors


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