medusajs/medusa · error · MedusaError

Property label with id: ${id} not found

Error message

Property label with id: ${id} not found

What it means

Thrown by GET /admin/property-labels/:id when the remoteQuery for entity 'property_label' filtered by id returns nothing. The route fetches with req.queryConfig.fields and 404s on an empty result.

Source

Thrown at packages/medusa/src/api/admin/property-labels/[id]/route.ts:36

 * @featureFlag view_configurations
 */
export const GET = async (
  req: AuthenticatedMedusaRequest,
  res: MedusaResponse<HttpTypes.AdminPropertyLabelResponse>
) => {
  const query = req.scope.resolve(ContainerRegistrationKeys.QUERY)
  const { id } = req.params

  const {
    data: [propertyLabel],
  } = await query.graph({
    entity: "property_label",
    fields: req.queryConfig.fields,
    filters: { id },
  })

  if (!propertyLabel) {
    throw new MedusaError(
      MedusaError.Types.NOT_FOUND,
      `Property label with id: ${id} not found`
    )
  }

  res.json({ property_label: propertyLabel })
}

/**
 * Update a property label.
 * @since 2.10.3
 * @featureFlag view_configurations
 */
export const POST = async (
  req: AuthenticatedMedusaRequest<HttpTypes.AdminUpdatePropertyLabel>,
  res: MedusaResponse<HttpTypes.AdminPropertyLabelResponse>
) => {
  const query = req.scope.resolve(ContainerRegistrationKeys.QUERY)

View on GitHub (pinned to 5e06e544a2)

Solutions

  1. List property labels (GET /admin/property-labels) and use current ids
  2. Recreate the label if it was deleted but still needed
  3. Refresh client caches after label maintenance operations

Example fix

// before
const { property_label } = await sdk.client.fetch(`/admin/property-labels/${id}`)

// after
const { property_labels } = await sdk.client.fetch("/admin/property-labels")
if (!property_labels.some((l) => l.id === id)) {
  throw new Error(`Property label ${id} missing`)
}
Defensive patterns

Strategy: validation

Validate before calling

const { property_labels } = await sdk.client.fetch("/admin/property-labels")
if (!property_labels.some((l) => l.id === labelId)) throw new Error(`Label ${labelId} not found`)

Type guard

const isPropertyLabel = (v: unknown): v is { id: string } & Record<string, unknown> =>
  !!v && typeof v === "object" && "id" in v

Try / catch

try {
  return await getPropertyLabel(id)
} catch (e: any) {
  if (e.statusCode === 404) { refreshLabels(); return null }
  throw e
}

Prevention

When it happens

Trigger: Requesting a property label id that does not exist or was deleted.

Common situations: UIs referencing labels removed during taxonomy cleanup, stale ids after re-seeding, or wrong-environment ids in scripts.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


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