medusajs/medusa · warning

'link' property is missing.

Error message

'link' property is missing.

What it means

As part of validating custom field configs, validateLink checks that the object passed to defineCustomFieldConfig includes a `link` property. Without it the generated link registration would be broken, so validation fails (returns false) and the config is reported as invalid.

Source

Thrown at packages/admin/admin-vite-plugin/src/custom-fields/helpers.ts:111

 * @param file - The file path.
 * @returns - True if the 'link' property is present, false otherwise.
 */
export function validateLink(
  path: NodePath<ExportDefaultDeclaration>,
  file: string
): boolean {
  const configArgument = getConfigArgument(path)

  if (!configArgument) {
    return false
  }

  const linkProperty = configArgument.properties.find(
    (p) => isObjectProperty(p) && isIdentifier(p.key, { name: "link" })
  ) as ObjectProperty | undefined

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

  return true
}

View on GitHub (pinned to 5e06e544a2)

Solutions

  1. Add the `link` property pointing to the link exported from ./links
  2. Create the links.ts file with defineLink if it does not exist
  3. Re-run the build/dev server to revalidate

Example fix

// before
export default defineCustomFieldConfig({ model: "product" })

// after
import link from "./links"
export default defineCustomFieldConfig({ model: "product", link })
Defensive patterns

Strategy: validation

Validate before calling

const cfg = defineCustomFieldConfig(...)
if (!("link" in cfg)) throw new Error("'link' property is required")

Type guard

const hasLinkKey = (c: object): c is { link: unknown } => "link" in c

Prevention

When it happens

Trigger: A custom field config object literal without a `link` key, validated during the plugin's config validation pass.

Common situations: New custom field created from a partial template; link import removed during cleanup but config left in place.

Related errors


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